Lou Dobbs said yesterday CNN was eager to show him the door because its top execs didn’t want to offend President Obama.

Dobbs made the claim last night on Fox News Channel’s “The O’Reilly Factor,” saying he took on President George W. Bush’s immigration policy with equal force but didn’t draw any CNN flak then.

“I discern more of a difference between then, which was under the Bush administration when I was criticizing, and now, when it is the Obama administration — and an entirely different tone was taken,” said Dobbs.

He claims both Bush and Obama are soft on illegal immigration.

CNN bosses told Dobbs — a strong opponent of illegal immigration — that the network wants to aggressively market itself as the neutral alternative to left-leaning MSNBC and conservative Fox, he said.

The Post reported that CNN paid Dobbs an $8 million severance to leave 1½ years before his contract expires.

Dobbs said he found CNN’s drive to the middle oddly timed to the beginning of Obama’s term.

“I don’t know whether that was the distinction that triggered any sort of response or a difference in perspective on the part of CNN’s management, but it is the only difference between the way I was conducting myself under this administration and the previous administration,” said Dobbs, who did his last show for CNN on Wednesday.

Host Bill O’Reilly bluntly asked Dobbs if he’d consider a run for a New Jersey US Senate seat, and the former CNN anchor didn’t dismiss it.

“A lot of things are on my mind, I’m not going to be coy about that,” Dobbs said.

“My wife and I are thinking about a lot of opportunities. I’m very blessed that I have a lot of opportunities. I guarantee you 100 percent I’m going to remain in the public arena.”

And Dobbs showed some political moxie when O’Reilly fired an odd query at him: “Final question, Barack Obama, is he the devil?”

Dobbs didn’t take the bait, but offered a well-measured answer to satisfy O’Reilly’s decidedly conservative viewers.

“He’s not the devil, but he is certainly a man who is right now not making it easy to understand why he’s making the public-policy choices that he is,” Dobbs said.