Mayor de Blasio parted ways with a key Democratic ally Friday by pushing ahead with a “millionaires tax” to fund the MTA — even if the federal tax overhaul is enacted.

“If that bill passes and there’s massive tax giveaways to the wealthy and corporations, then the idea of a state millionaires tax to fund the MTA becomes even more relevant,” the mayor said on WNYC radio.

“Because the same millionaires and billionaires will be doing even better than ever before if they get massive tax relief from Washington so they should pay higher state taxes to take care of the MTA. So that is where the action is …”

That contradicts the analysis of Assemblyman Speaker Carl Heastie, the mayor’s closest ally in Albany.

Heastie said earlier this week in Albany that it would be crazy to go forward with the millionaires tax because that would add an incentive for the wealthy to flee the state since the the new tax bill would slam the rich by limiting the federal deduction for state and local income taxes.

“It would be very difficult to ask those same people to then pay an additional state income tax where that addition is not federally deductible,” Heastie said.

GOP leaders plan to submit a tax bill next week that would limit the deduction for state and local income, sales and property taxes to $10,000 combined.

The combined state and local income tax rate in New York City tops out at 12.7 percent, second only to California’s 13.3 percent.