The city is turning up the heat on lawyers serially suing NYPD Detective David Terrell by pursuing punishments for “frivolous” claims, The Post has learned.

Lawyers for the city told a judge recently that they will seek sanctions in a police-misconduct case brought by Shawn Nardoni, a Bronx teen who claims Terrell arrested him in 2015 and made him falsely finger another teen, Pedro Hernandez, for a shooting.

The case was dismissed by a Manhattan federal judge last month. Now the city says Nardoni’s lawyers should have known the claims were bogus.

The city’s Law Department said it told the law firm representing Nardoni, Nwokoro & Scola, “from the outset” that their client was not arrested on the dates he claimed and “the alleged subsequent criminal case did not exist,” according to Manhattan federal court papers.

But they continued to pursue his claims anyway, the filing said.

The same lawyers recently dropped another case against Terrell, filed by Angelo Cotto, after the city threatened sanctions in that case, too, according to sources.

“The city threatens sanctions in a lot of cases but sanctions are only appropriate in a few of those cases,” said Nardoni’s lawyer, Emeka Nwokoro.

Nwokoro said he withdrew Cotto’s lawsuit after the city provided “documents that would have made it extremely unlikely for Mr. Cotto to prevail in his claims.”

Terrell, who joined the NYPD in 2002, has seen several misconduct lawsuits against him tossed in recent months, including one that had him stripped of his badge and gun because it accused him of paying a game of dice to determine a young man’s arrest.

The Bronx detective has filed a $175 million notice of claim against the city, accusing it of creating a “cottage industry” for gang members looking to squeeze taxpayers with bogus complaints of police misconduct. He remains on modified duty.

In an interview with The Post, Terrell described the city’s efforts to seek sanctions as bittersweet, saying he’s glad they’re seeking to punish the frivolous suits but worries it’s too little too late.

“I’m glad but I want more. I want a lot more. I don’t think they should even be practicing law,” he said. “This should have been done a long, long time ago.

“If this had been a police officer doing this there would be hell to pay,” Terrell added.

The Law Department wants to recoup its costs associated with defending the Nardoni case and may also seek fines or other punitive costs, according to a source.

“We will seek sanctions when officers are sued without any evidentiary basis,” a spokesman for the city’s Law Department said.