It’s one thing for Mayor Bloomberg to play nanny and hector New Yorkers about smoking and trans fats, as he never stops doing. But it’s quite another for him to grab the flag and start scolding foes of that planned mosque near Ground Zero, as he did Friday.

The mayor was way, way out of line.

“A handful of people ought to be ashamed of themselves,” he huffed.

Well, we know one person who should be ashamed: him.

Bloomberg got downright apocalyptic, calling the controversy “[as] important [a] test of the separation of church and state . . . as we may see in our lifetimes.”

He bashed those who wanted to use the city’s landmarking process to stop the mosque and insisted government has no business prying into its finances.

“Do you really want every time they pass the basket in your church, and you throw a buck in, they run over and say, ‘OK, now, you know, where do you come from?’ ” Hizzoner asked.

Of course not. But that misses the point by a mile — and he well knows it.

The notion that the mosque controversy is a battle over religious freedom is utterly bogus. And it glosses over New Yorkers’ entirely legitimate concerns.

Nor is there a question of whether the mosque should be forced to reveal the sources of its funding — though its failure to do so certainly heightens suspicions.

Let’s face it: The majority of New Yorkers who oppose the project have every right to do so — unless Mayor Religious Freedom doesn’t believe in freedom of speech, or freedom of opinion.

And New Yorkers have every right to be curious about this project, especially.

The mosque’s leader, Imam Faisal Abdul Rauf, claims to seek “interfaith understanding” — but just how “moderate” is it to launch a project he knows will inflame passions? Plus, he reportedly has ties to radical Islamists and refuses to label Hamas a terrorist group.

Meanwhile, Saudi Arabia has been dedicated to spreading the Wahhabi ideology that spawned al Qaeda — and 9/11. If Saudi money is meant to make this mosque part of that cause, don’t New Yorkers (of all people!) have a right to know?

We don’t begrudge Bloomberg his opinion, of course — wrong as we think it is. But he has no right to begrudge others of theirs. And surely no right to insult them.