The latest episode of Bill Maher’s show “Real Time” performed what was, in effect, an in-studio social experiment.

It sought to establish, in a controlled setting, the answer to this pressing question: How long could Maher and atheist author Sam Harris talk frankly about the illiberalism of much of the Muslim world before actor and director Ben Affleck, another guest, accused them of racism?

The result is in: Not very.

In fact, almost as soon as Maher and Harris began to discuss how liberals are betraying their own convictions if they don’t stand up against social backwardness in the Muslim world, Affleck grew visibly agitated.

He could barely contain himself when Harris opined, “We have been sold this meme of Islamophobia, where every criticism of the doctrine of Islam gets conflated with bigotry toward Muslims as people.”

That’s when Affleck interrupted, and soon enough, he was calling Maher and Harris out for their grossness, ugliness and, yes, racism. How does it feel, guys?

You might be wondering, “Why should I care what the new Batman thinks?” The exchange was so notable because all three are men of the left in good standing.

As a walking embodiment of liberal piety, Affleck is emblematic of liberalism’s see-no-evil discomfort with frank truths about the Muslim world.

The prelude to the intraliberal fight was the prior week’s show, when Maher pointed out the absurdity of liberals getting exercised over, say, actor Jonah Hill using an anti-gay vulgarism, but ignoring that gays can be stoned in Muslim countries.

“To count yourself as a liberal,” Maher declared, “you have to stand up for liberal principles” — meaning across the board.

Maher had zeroed in on one of the more perverse aspects of contemporary politics, which is that self-consciously tolerant liberals often look the other way when confronted with the intolerance of the Muslim world.

For them, saying discouraging things about Islam feels too judgmental. It requires insisting on the superiority of some Western standards. It means jettisoning the comforting fictions of multiculturalism.

It entails resisting the reflex to consider any criticism of the Third World as presumptive racism.

As militant atheists, Maher and Harris feel free of these constraints; criticizing religion is part of what they do for a living. As a garden-variety liberal, Affleck is subject to all of them and reacted as if two Klansmen had wandered onto the set with him.

When Maher and Harris pointed out how widespread retrograde attitudes are in the Muslim world, Affleck said they were “stereotyping.”

But the data doesn’t stereotype. Especially in less-developed countries, it is appalling.

The percentage of Muslims in Middle Eastern and South Asia countries who say honor killings are never justified is shockingly low (31 percent in Egypt, 45 percent in Pakistan).

Support for the stoning of adulterers is more than 40 percent in Bangladesh and 80 percent in Afghanistan. The death penalty for leaving Islam is almost, although not quite, as popular as stoning.

Affleck simply couldn’t handle the truth. He kept on insisting it’s just a few bad apples who think this way. At one point, he tried to wave Maher and Harris off with a condemnation of the Iraq War, positing an implicit moral equivalence between an overly idealistic war of liberation and the stoning of apostates.

Affleck obviously isn’t a public official or a public intellectual. But he represents a dominant tendency within liberalism.

Imagine a State Department staffed by less-glamorous Ben Afflecks. Imagine a president of the United States who shares his instincts.

This is the Obama administration. That’s why, in part, it has always been so reluctant to speak of Islamic terrorism and extremism. It’s why the president says the Islamic state is not Islamic.

The nation is truly in peril if Bill Maher, of all people, is more clear-eyed than those running our government.