President Trump jumped head first into a bitter Republican congressional primary on Staten Island — endorsing incumbent Rep. Dan Donovan over his predecessor, convicted tax cheat Michael Grimm.

“There is no one better to represent the people of N.Y. and Staten Island (a place I know very well) than @RepDanDonovan, who is strong on Borders & Crime, loves our Military & our Vets, voted for Tax Cuts and is helping me to Make America Great Again. Dan has my full endorsement!,” Trump said in a surprise Wednesday night tweet.

But Trump’s initial endorsement tweet of Donovan was not entirely accurate.

In fact, Donovan voted against the Trump-inspired tax reform law last December, arguing new restrictions on deductions of state and local taxes would hurt many of his constituents.

Still, Trump said Donovan was a safer choice than Grimm to win the general election than Grimm.

“Very importantly,@RepDanDoovan will win for the Republicans in November . . and his opponent will not,” Trump said. “Remember Alabama. We can’t take any chances on losing to a Nancy Pelosi controlled Democrat!”

Trump was comparing convicted felon Grimm to Alabama’s disgraced GOP senatorial candidate Roy Moore, who lost his election to Democrat Roy Moore following numerous accusations of sexual misconduct.

Donovan, a three-term district attorney ran for the congressional seat after Grimm, an ex-FBI agent and Marine, was forced to step down in 2015 after pleading guilty to tax evasion in connection with a Manhattan restaurant business he ran.

Grimm was quick to point Donovan’s votes against the president.

“All the endorsements in the world can’t change the facts: Donovan has failed to pass even one substantive bill into law, and has voted against President Trump every time it’s mattered – from failing to repeal Obamacare, to banning sanctuary cities, and even against tax cuts,” Grimm said in a tweet.

Donovan was thrilled.

“JUST IN: President Trump endorsed our campaign! As fellow New Yorkers this is very exciting news. We’re excited to continue working together for the American people. Join President Trump and endorse Dan here,” Donovan tweeted.