He may have publicly supported Hillary Clinton in the 2016 presidential race, but Mayor de Blasio is turning to Clinton’s lefty opponent, Vermont Sen. Bernie Sanders, to swear him in for a second term on New Year’s Day.

Hizzoner botched his endorsement of Clinton by waiting too long to provide it — while struggling to explain why he wasn’t backing his seemingly progressive kindred spirit, Sanders.

De Blasio often attributed his endorsement to Clinton’s electability and ability to get things done.

This year, de Blasio has been more open in his support for Sanders as a progressive leader and in October scored Sanders’ endorsement in the mayoral general election.

“Senator Sanders is a proud son of Brooklyn and a dedicated advocate for working people,” de Blasio said in a statement. “Sen. Sanders’ progressive leadership has helped reshape the American political debate in favor of men and women long left out of our city and nation’s prosperity.”

Officials say this will be a scaled-down inauguration compared to four years ago when de Blasio was sworn in by former president Bill Clinton.

They expect up to 1,500 people at the noon event at City Hall, and warned that cold weather might lead to contingency plans.

The total cost is expected to be $200,000, with a portion paid with private funds.