Rep. Ilhan Omar’s ex-husband learned of her alleged affair with her chief fundraiser when he walked in on the two lounging around her apartment in pajamas  — and the jilted hubby will be paid tens of thousands of dollars to stay silent, according to a report.

Ahmed Hirsi made the shocking discovery last spring, during a surprise visit to his then-wife’s Washington, DC apartment from Minnesota, where he was living with their three children, the Daily Mail reported.

“It’s wasn’t that he actually caught them in bed,” a source told the Mail of Hirsi walking in on Omar and her chief fundraiser Tim Mynett, who was also married at the time.

“But they were clearly in a romantic situation,” the source said of the pajama-clad lovers.

The cuckolded Hirsi’s family then joined with Omar’s family in reaching a financial settlement that bars him from speaking publicly about the breakup, the Mail reported, citing unnamed sources.

Hirsi had suspected Omar was cheating, “but she kept telling him he was paranoid,” and insisted he stay in Minnesota with the children, the source told the Mail. He was left “angry and humiliated” by the discovery, the source said.

He will now collect as much as $250,000 over six years if he keeps his mouth shut, the source told the Mail.

Omar, 37, and Mynett, 38, have declined to comment on their relationship, which was outed by Mynett’s then-wife, Dr. Beth Mynett, 55, in explosive divorce filings.

The now-divorced Mynett owns a campaign financing consultancy company, E Street Group, that has been on Omar’s campaign payroll since July 2018.

Omar’s campaign paid E Street $216,564 in the last three months of last year, according to the latest Federal Election Commission filings.

Requests for comment from the Post to Omar were not immediately returned.

Hirsi, 40, and Omar were divorced in November and remarried Dec. 12.