An openly gay foreign affairs guru who is a prolific Twitter user has landed on President-elect Donald Trump’s short list to be the US ambassador to the United Nations, The Post has learned.

Richard Grenell, 50, who served as spokesman to four US ambassadors to the UN under President George W. Bush, would be the first openly gay American to be UN ambassador.

Grenell has been a critic of the Iran nuke deal and slammed the Obama administration, including then-Secretary of State Hillary Clinton, for failing to put Boko Haram on the terror list.

Grenell is pro-Israel.

“Ric Grenell has proven to be stridently pro-Israel,” said Arthur Schwartz, a strategist for Jewish American groups that back Israel.

In many Muslim countries with Sharia law, homosexual acts are illegal and even punishable by death.

In 2012, Grenell briefly served as presidential candidate Mitt Romney’s national security and foreign affairs spokesman. But he abruptly resigned, reportedly over concerns about his sexual orientation.

Grenell is co-founder of Capitol Media Partners, a PR firm with offices in New York, DC, Los Angeles and San Francisco.

Like Trump, Grenell is a prolific tweeter.

In 2012, he taunted then-presidential candidate and former House Speaker Newt Gingrich.

Grenell was advising Romney, Gingrich’s GOP foe, at the time.

“Let’s have Newt rate all his wives…. Newt compliments all the wives proving he can’t pick just one 1st lady,” he tweeted in January 2012.

And this: “What’s higher? The number of jobs newt’s created or the number of wives he’s had?”

He even fat-shamed Gingrich.

“I wonder if newt has investments in Lipitor,” he tweeted.

He also joked that Gingrich and Elton John were look-alikes.

Grenell was the US spokesman at the UN during the world body’s most turbulent time. He led communications strategies on issues such as the wars in Afghanistan and Iraq following 9/11; peacekeeping operations in Haiti, Liberia, the Congo and Sudan; the conflict in the Middle East; Iran’s nuclear weapons program; North Korea’s nuclear proliferation; the Syria/Lebanon conflict; Israel’s security; and the UN’s Oil-for-Food Program corruption scandal.