You ain’t in Thailand anymore, buddy.

A high-ranking member of the Thai air force was arrested for patronizing a prostitute late Saturday — and promptly released because he has diplomatic immunity, according to police.

Cops from the Manhattan South vice squad collared Rawin Thanomsingah at the Marriott on Lexington Avenue around 11 p.m., the NYPD said.

Thanomsingah was released shortly after midnight Sunday — once officials confirmed his diplomatic immunity, according to cops.

Police said Thanomsingah is a brigadier general in the Thai Royal Air Force. No such rank exists, but a man with a similar name is a group captain in the branch.

Police could not immediately confirm they are the same person.

The arrest was part of an NYPD “hotel operation” to catch Johns, a source said.

It was not immediately clear if Thanomsingah was staying at the Midtown hotel or had only gone to meet the faux pro.

The NYPD has been posting fake ads for hookers and arresting would-be Johns who show up for dates. In some cases, the police texted guys who never showed up and revealed they got lucky — by voiding arrest.

The Thai consulate did not return a request for comment Sunday.