The MTA knew for years that the new Hudson Yards ­7-train terminal had serious leak issues — but its contractors couldn’t fix the problem and the agency opened the $2.4 billion station anyway, court records show.

Head builder Yonkers Contracting as far back as 2011 noticed water in the under-construction station on the Far West Side. In 2014 it sued the companies that it had hired to lay down concrete and waterproofing, claiming that the subcontractors had botched the job and the repairs.

The waterproofing company then countersued Yonkers, alleging that Yonkers used spray-on “shotcrete” instead of the real stuff to cut corners.

The spray-on concrete was shoddy and incompatible with the waterproofing, and the subcontractors told Yonkers ahead of time of the looming problem, sources said.

“Either the MTA didn’t want to acknowledge publicly what a problem this was or they didn’t know the scope of it, but at some point they caught on that this was a systematic failure and it couldn’t be fixed with some patches,” said a source close to the situation.

The MTA learned of the leaks as far back as 2013 and issued a stop-work order at the station while the contractors tried to sort out their differences and figure out how to fix the problem.

In a meeting in 2013, MTA engineers met with the contractors to tell them that the problems were severe.

The engineers “explained that water pressure at locations where the waterproofing spanned over the voids of the shotcrete could cause the waterproofing system to collapse into the void areas and rupture,” reads one of the lawsuits. “They believed that such circumstances had caused water leaks on the project.”

None of the companies was able to stop the water flow, but the MTA opened the terminal in September. Six months later — as first reported by The Post — the station is frequently inundated with water that has caused restrooms and some escalators to remain out of order.

The MTA said Yonkers has agreed to pay for a grouting company to fix the leaks. The work will start Monday.