Senator Bernie Sanders endorsed Mayor de Blasio’s re-election bid at a campaign rally on the West Side Monday night – billing him as the antidote to a national government led by President Trump.

“Everything that Mayor de Blasio is trying to do is exactly the opposite of what Donald Trump is trying to do,” Sanders said to an audience of about 300 de Blasio supporters. “This mayor is leading the city in a way to bring us together.”

De Blasio famously did not back Sanders during his 2016 presidential run, instead taking six months to endorse Hillary Clinton in the run-up to the Democratic primary – after nearly all other prominent New York State Democrats threw their support behind her.

But that slight – and any mention of Clinton — did not come up during the rally, which at times felt more like the endorsement of the Brooklyn-bred Vermont senator de Blasio never made.

De Blasio showered Sanders with praise in his introduction, crediting him as the founder of a movement to combat income inequality.

“There’s going to be a day when the one percent finally pay their fair share in taxes. And that day is going to come, and when it comes, you’re going to look back and say, who started all of this?” he said. “Who showed us the way? Ladies and gentleman, Bernie Sanders.”

De Blasio also held up Trump as a reason for people to cast their ballot for him, referring to his presidential win last year – with no mention of his opponent Clinton — as a “rude awakening.”

In another awkward moment, de Blasio amped up his populist rhetoric with a broadside against the city’s real estate developers – despite the fact that one who donated to his campaign, Jona Rechnitz, testified last week to making campaign contributions in exchange for political favors.

“This is your city,” de Blasio told the crowd. “It does not belong to landlords. It doesn’t belong to real estate developers. It doesn’t belong to the titans of Wall Street and, Lord knows, it does not belong to Donald Trump.”