President Trump on Wednesday sought to turn the defeat of Republican Roy Moore in Alabama’s special election into his own personal victory — saying he was right in predicting the candidate was doomed from the start.

“The reason I originally endorsed Luther Strange (and his numbers went up mightily), is that I said Roy Moore will not be able to win the General Election,” Trump said in an early morning tweet.

“I was right! Roy worked hard but the deck was stacked against him!”

After being endorsed by Trump, the Republican lost a close race to Democrat Doug Jones in the Cotton State, where the president won by about 30 points in the 2016 election.

The president had previously backed Strange, the incumbent Republican senator who lost to Moore by nine points in the primary.

After Strange lost, Trump deleted all tweets endorsing him and wrote in support of Moore, applauding him on his victory and calling him a “really nice guy.”

“Congratulations to Roy Moore on his Republican Primary win in Alabama. Luther Strange started way back & ran a good race. Roy, WIN in Dec!,” Trump tweeted at the time.

Moore — who sought to fill the seat vacated by fellow Republican Jeff Sessions when he became attorney general — was then buffeted by accusations that he had preyed on underage girls when he was in his 30s.

At first, Trump said it was up to Alabama voters to decide the race, but later gave Moore his full-throated support as someone who would back his legislative agenda.

Late Tuesday, Trump congratulated Jones on a “hard fought victory.”

Meanwhile, CNN’s Anderson Cooper, whose network Trump has repeatedly lambasted as a purveyor of “fake news,” apparently didn’t mince words in response to the president’s tweet Wednesday.

“Oh Really? You endorsed him you tool! Pathetic loser,” Cooper posted shortly before 7 a.m.

But a few minutes later, he claimed his Twitter account had been hacked.

“just woke up to find out someone gained access to my twitter account. i have not sent a tweet in days or replied to any tweets. We are looking into how this happened,” Cooper tweeted.