A funny thing happened on Nigella Lawson’s way to America: She was prevented from boarding her flight at Heathrow. Since then, she has been “invited” to apply for a visa to the United States, and promised by our embassy in London that her request would be “handled routinely and expeditiously.”

At issue is the celebrity chef’s admission in a British court that she has snorted cocaine several times. Even though she was never convicted, this would be enough for US authorities to deny her entry.

But these issues are handled on a case-by-case basis. Our question is this: If Lawson is indeed unfit to come here because she’s admitted to using cocaine, why was she allowed in the country on New Year’s Day — three weeks after she made her well-publicized confession in court? And given that, why the slap-dash, last-minute effort to keep her off the plane this time?

We can’t know the facts behind the decision, because Homeland Security won’t release them, owing to privacy concerns. What we do know, as The Post has reported, is that many other foreigners famously involved with drug use that seems much worse than Lawson’s have been allowed in, including the crack-smoking mayor of ­Toronto, Rob Ford.

We don’t want our government giving celebs special rights to enter the United States, especially those with drug issues. But we would hope we aren’t singling them out for special humiliation either.