The city’s generous new parental leave policy has sparked a battle between young and older city workers — and now it’s headed to court.

The New York City Managerial Employees Association, which reps thousands of workers, is filing a lawsuit Friday against the city for discriminating against older workers, who lost vacation days and a raise to pay for the policy.

“It’s really discriminating against older people,” said MEA president Stuart Eber.

The policy, unveiled by Mayor de Blasio in January, gives six weeks of paid leave to non-union city employees. To pay for it, he slashed a .47% raise planned for 2017, and cut two extra vacation days granted to those with 15 or more years on the job.

Those managers tend to be older, and won’t benefit from the policy, the lawsuit claims.

The parental leave policy — one of the most generous in the country in the public sector — applies only to about 20,000 managerial employees, and not union workers.

Changes to their parental leave policies must be done through collective bargaining.

A spokesman for the mayor defended the administration’s plan.

“This is a common sense policy that will make for healthier and more financially stable working families, and a more effective city government,” said Monica Klein.

A Law Department spokesman said they could not comment on the merits of the case and are reviewing the lawsuit.

Stuart Salles, the lawyer for the management group that’s suing, stressed that they supported the policy, just not how it was funded.

“It’s an excellent policy,” he said of parental leave.