Former President Barack Obama admitted that Joe Biden’s debate performance Thursday night was “bad” — but still urged voters to back his former veep over Donald Trump.

“Bad debate nights happen. Trust me, I know,” Obama, 62, wrote on X Friday afternoon.

Biden, 81, left much to be desired during Thursday night’s war of words, during which he appeared to freeze at several points and was often mumbling and tripping over phrases.

“But this election is still a choice between someone who has fought for ordinary folks his entire life and someone who only cares about himself,” Obama insisted.

“Between someone who tells the truth, who knows right from wrong and will give it to the American people straight — and someone who lies through his teeth for his own benefit.

“Last night didn’t change that, and it’s why so much is at stake in November.”

Biden’s dismal showing created major doubts about his ability to appear on the ticket come Election Day — though rumors of his imminent replacement were shot down by aides who said he was already gearing up for September’s rematch.