Well, that’s a unique defense.

An ex-NYPD official battling corruption charges claimed Tuesday that his romp with a hooker on a trip to Las Vegas can’t be considered a bribe — because he paid for her services.

In court papers, ex-Deputy Inspector James Grant said prosecutors want former prostitute Gabi Grecko to testify against him to prove she served “as a form of bribery and a part of a quid pro quo” involving former Mayor Bill de Blasio donor-turned-government witness Jona Rechnitz.

But Grant said that FBI Special Agent Joseph Downs “definitively” testified before a federal grand jury that Grant personally paid the call girl, adding that Grecko and Rechnitz “both corroborate each other” on that point.

Grant also cited Rechnitz’s testimony last year that he “had nothing to do” with arranging or paying for Grecko’s services, and noted a Post report in which Grecko admitted that Grant paid her around $1,500.

“By definition, Mr. Grant needs to have actually received a thing of value from his alleged bribers,” defense lawyer John Meringolo wrote.

“It is inarguable that to the extent Mr. Grant purchased an item or service for himself, that said item or service cannot be simultaneously said to have been purchased or provided by Mr. Rechnitz.”

The Post exclusively revealed in 2016 that Grecko engaged in mile-high sex with Grant, another cop and three other men while en route to Sin City in a private plane paid for by Rechnitz to watch Super Bowl XLVII.

Grecko — now an aspiring rapper who calls herself “Glitta Foxx” — admitted that she “was doing it while they were in their seats” and later shared a penthouse at the MGM Grand Hotel & Casino with Grant.

Tuesday’s Manhattan federal court filing said prosecutors’ “insistence on calling [Grecko] to testify cannot be interpreted as anything but a tactic to improperly prejudice Mr. Grant in the eyes of the jury.”

“To parade [Grecko] before a jury for the sole purpose of exposing Mr. Grant’s personal and intimate indiscretions is not just unfairly prejudicial and misleading but a patent waste of the Court’s time during an already lengthy trial schedule,” Meringolo wrote.

Grant — who faces trial next month — is married to lawyer Michele Sileo, and the bribes he allegedly accepted from Rechnitz and co-defendant and former de Blaiso donor Jeremy Reichberg include a video-game system for their kids.

Tuesday’s court papers also said that “the fact that a prostitute was present on the Las Vegas flight is inconsequential and provides no contextual background to the trip,” arguing that Rechnitz can provide all the necessary details during his testimony.

“And realistically, it is highly doubtful that she would have knowledge or any pertinent information to offer in this regard, as her interactions with the co-defendants were limited,” Meringolo added.

The Manhattan US Attorney’s Office declined to comment.