President Obama made a secret deal to support Hillary Clinton when she runs for president in 2016, campaign sources say, payback for the support her husband gave him in 2012.

Bill Clinton’s animosity toward Obama is legendary. A year before the last election, he was urging Hillary to challenge the sitting president for the nomination — a move she rejected.

According to two people who attended that meeting in Chappaqua, Bill Clinton then went on a rant against Obama.

“I’ve heard more from Bush, asking for my advice, than I’ve heard from Obama,” my sources quoted Clinton as saying. “I have no relationship with the president — none whatsoever. Obama doesn’t know how to be president. He doesn’t know how the world works. He’s incompetent. He’s an amateur!”

BLOOMBERG’S VISIT ALL ‘FORE’ NOTHING

For his part, Obama wasn’t interested in Bill Clinton upstaging him during the presidential campaign. He resisted giving him any role at the convention.

But as last summer wore on, and Democrat enthusiasm waned, chief political strategist David Axelrod convinced the president that he needed Bill Clinton’s mojo.

A deal was struck: Clinton would give the key nominating speech at the convention, and a full-throated endorsement of Obama. In exchange, Obama would endorse Hillary Clinton as his successor.

Clinton’s speech was as promised; columnists pointed out the surprising enthusiasm in which he described the president. It also lived up to Obama’s fears, as more people talked about Clinton’s speech in the weeks following than his own.

But after his re-election, Obama began to have second thoughts. He would prefer to stay neutral in the next election, as is traditional of outgoing presidents.

Bill Clinton went ballistic and threatened retaliation. Obama backed down. He called his favorite journalist, Steve Kroft of “60 Minutes,” and offered an unprecedented “farewell interview” with departing Secretary of State Hillary Clinton.

The result was a slobbering televised love-in — and an embarrassment to all concerned.

It is just one of the debacles that have marked Obama’s second term, from Benghazi to the IRS scandal. While he was effective on the campaign trail, once in the Oval Office, he becomes a different person, one who derives no joy from the cut and thrust of day-to-day politics and who is inept in the arts of management and governance.

Obama has made a lot of promises — and nothing ever happened.

He once boasted that he’d bring the Israelis and Palestinians to the negotiating table and create a permanent peace in the Middle East. Nothing happened.

He said he’d open a constructive dialogue with America’s enemies in Iran and North Korea and, through his special powers of persuasion, help them see the error of their ways. And nothing happened.

He said he’d solve the worst financial crisis since the Great Depression and put millions of people back to work. And nothing happened.

He may yet try to back out of his promise to Hillary Clinton. But as Obama’s presidency sinks deeper into scandal and inaction, the question is — will Clinton even still want his endorsement?

Adapted from the new paperback edition of Edward Klein’s “The Amateur: Barack Obama in the White House” (Regnery Publishing), out this week.