Microsoft co-founder Bill Gates was like a “kid in the candy store” when it came to young interns at the software company — forcing management to ban them from being alone with the billionaire, according to a bombshell new book.

The upcoming tell-all by New York Times journalist Anupreeta Das paints an unflattering portrait of one of the world’s richest men, offering salacious details about his alleged infidelity that left his wife Melinda French Gates “seething for a long time.”

It was “not unusual for Gates to flirt with women and pursue them, making unwanted advances such as asking a Microsoft employee out to dinner while he was still the company’s chairman,” Das wrote in “Billionaire, Nerd, Savior, King: Bill Gates and His Quest to Shape Our World,” according to excerpts reported by DailyMail.com.

Former Microsoft CEO Bill Gates was reportedly quite “flirty” with young interns at the software company. Getty Images

The problems arose almost immediately after the couple got married in 1994, with Gates pining for his former flame Ann Winblad, a tech entrepreneur, according to the the book, which hits stores Aug. 13.

He had an unusual arrangement with his wife that allowed him to visit Winblad once a year at her home in North Carolina, the book said.

According to Das, French Gates personally overhauled her husband’s security team due to her concerns that they were “enabling him to be places where [she] didn’t know he was at.”

The book also reported that his wife ordered the couple’s housekeepers not to give out his direct phone number when women called the house.

New York Times journalist Anupreeta Das authored a new book titled “Billionaire, Nerd, Savior, King: Bill Gates and His Quest to Shape Our World.” Amazon

The nerdy mogul “assumed his behavior would have no consequences,” according to Das, who wrote that the marriage eventually ended because of “different notions about the meaning of a marital contract.”

While she “genuinely believed being married would make a difference because of her deep belief in its sanctity,” Bill Gates thought that “love and marriage can often mean two different things,” according to Das.

The tycoon’s wandering eye allegedly extended to young women working at the Bill and Melinda Gates Foundation.

Gates and French Gates were married for 27 years before they divorced in August 2021. REUTERS

According to Das, Gates “flirted with some of the interns at the Gates Foundation, putting them in the uncomfortable position of having to think about their career prospects while not wanting to be hit on by the boss.”

“In one instance a colleague chastised one person for sending a 22-year-old intern to Gates’ office by herself, saying: ‘She’s too young and too pretty’,” Das wrote in the book.

Gates’ overtures to women were considered “clumsy rather than predatory,” people who witnessed them firsthand told Das.

One former Microsoft executive said Gates did not “prey on” women or ask for sexual favors in exchange for advancing their professional prospects.

“He’s not Harvey Weinstein…I know of no real situation in which anyone got anything for sleeping with Bill,” the former executive told Das.

Gates, 68, showed a “certain naivete in his interactions with women, mistaking engaged conversation for mutual interest,” the exec added.

The final straw for French Gates was her husband’s alleged friendship with convicted pedophile Jeffrey Epstein, who met Bill Gates numerous times after the disgraced financier pleaded guilty to procuring sex with a minor.

Gates’ friendship with convicted pedophile Jeffrey Epstein (seen center with Gates, who is photographed second from right, in 2011) outraged his then-wife, Melinda French Gates.

The couple divorced in 2021 and French Gates bolted the foundation earlier this year to launch her own philanthropic company.

The Post reached out to French Gates through her Pivotal Ventures for comment.

While married, Gates carried on a relationship with Ann Winblad, a tech investor. Horasis

A spokesperson for Bill Gates blasted Das and her book.

“Relying almost exclusively on second- and third-hand hearsay and anonymous sources, the book includes highly sensationalized allegations and outright falsehoods that ignore the actual documented facts our office provided to the author on numerous occasions,” the rep from Gates’ office said in a statement provided to The Post.

“Mr. Gates has previously stated his deep regret for ever meeting with Epstein, who he met with for discussions regarding philanthropy only.”