They’re the picture of marital bliss today but the Obamas were once headed for divorce — and friends of the future president worried he was suicidal during a low point in his career, controversial new biography “The Amateur” claims.

In 2000, after eight years of marriage, Barack Obama decided — despite Michelle’s objections — to challenge Democratic Congressman Bobby Rush in a primary on Chicago’s South Side. Obama was crushed in a 2-to-1 Rush landslide.

According to the book, the defeat left Obama a wreck. Edward Klein writes, “During the dark days that followed his defeat, he turned to Michelle for comfort. But she was in no mood for sympathy . . . He had refused to listen to her warnings about taking on” formidable Rush. The primary also left them in debt.

Klein, who claims his book is based on nearly 200 interviews, wrote that Obama confided to friends that they were talking divorce. “Michelle actually had divorce papers drawn up,” Klein writes, citing one of her friends.

“Obama was so depressed that some of his friends worried that he was suicidal,” the book adds, without elaboration.

Obama went on to win a US Senate seat in 2004 that helped establish his credentials for running for the White House four years later.

But Michelle almost vetoed the Senate race. Northwestern University professor Steven Rogers told Klein that Obama talked about his ambition after they met at a golf fund-raiser. “My wife will not allow me to run for the Senate until I clear up the debts from my unsuccessful run for Congress,” Obama said according to Rogers, who chipped in $3,000 and said Obama was then $8,000 in debt.

The White House dismissed Klein’s work as fiction. “Ed Klein has a proven history of reckless fabrication in order to sell books,” presidential spokesman Eric Schultz said. “Nobody in their right mind would believe the nonsense in this one.”