At long last, former President Barack Obama has endorsed Joe Biden, who claimed he didn’t want his ex-boss’ endorsement during the nominating process.

You know what? Maybe Biden was right, even though he was lying. Maybe he shouldn’t have wanted Obama’s endorsement. For while it is true that Obama is a genius at winning elections, he is only a genius at it when he’s the one running.

No one has ever done better for himself in US politics — or been as ineffectual in his efforts to get other people elected. No one has ever so thoroughly dominated politics — or so thoroughly decimated the party he led to victory.

When Obama was elected president in 2008, Democrats had been in control of the House of Representatives and the Senate for two years. His colossal victory — 70 million votes — extended Democratic congressional margins substantially. Indeed, for much of his first year, Obama had a supermajority in the Senate.

He only lost that supermajority because Ted Kennedy died — but in a pregnant sign that Obama wouldn’t be the transformational party leader he seemed at first, Democrats lost the Kennedy seat in Massachusetts in January 2010 to a little-known Republican named Scott Brown.

Truth to tell, Obama had ­already shown his feet of clay in 2009 in a series of endorsements that didn’t turn the tide for the candidates he stumped for. New Jersey Gov. Jon Corzine lost his reelection bid to Chris Christie, while Democratic gubernatorial candidate Creigh Deeds was blown out in Virginia.

And a few months later, in 2010, Obama went all in for Arlen Specter in Pennsylvania — a deeply unpleasant Republican who had desperately gone Democrat because he had lost the confidence of his original party — only to see Specter lose . . . in the Democratic primary! (The guy who beat Specter then lost in November.)

True, Obama secured four massive pieces of legislation in his first 15 months in office and increased Washington spending by some $2.5 trillion — but in the process, he midwifed a conservative revolt in the form of the Tea Party.

By the time the nation voted in the midterm elections in 2010, Obama had all but thrown in the towel. In his last rally before the November vote, with Biden at his side, Obama said, “We’ve made progress. But I know that sometimes, as we’re grinding out this change, and there’s all the negative ads and the pundits on TV, and there’s still a lot of unemployment out here, people feel discouraged.”

Three days later, Republicans seized control of the House of Representatives by taking 63 seats away from Obama’s Democrats while winning back six Senate slots as well. Obama himself called the defeat a “shellacking” and ruefully acknowledged that “sometimes we lose track of the ways that we connected with folks that got us here in the first place.”

He began running for re-election almost immediately afterward and ran a blindingly brilliant campaign striking in its use of social-media technology to target voters and drive them to the polls.

A key Mitt Romney adviser told me afterward that he and his colleagues were blindsided by the relative ease with which Obama won because their polling showed Obama’s support to be extraordinarily soft. Asked how excited they were to vote on a scale between 1 and 10, a shocking number rated themselves a 1 or a 2 — and prior experience led the Romneyites to believe most of those potential voters would stay home.

But they didn’t, because the Obama campaign figured out new ways to encourage the unenthusiastic and drive them (sometimes literally) to the polls. He won 51 percent of the vote nationwide.

And yet, once again, when voters went to the polls in 2014, Obama’s help availed Democrats nothing. Quite the opposite, in fact. Republicans took nine Senate seats away from Dems and gained complete control of Congress.

By 2016, when Obama’s anointed successor Hillary Clinton lost to Donald Trump, the Democratic Party was in tatters. It wasn’t just the House and Senate the GOP came to dominate. Over the course of his presidency, more than 1,000 elected offices in the United States (out of 8,800 total) changed hands from Democrats to Republicans.

At the end of Obama’s tenure, Republicans held the majorities in 69 out of 99 state legislative bodies and 33 governor’s mansions (when they had held only 19 in 2009).

So congratulations on the endorsement you didn’t want, Joe Biden. You may live to regret it.

jpodhoretz@gmail.com