A court will soon decide which is stronger: a New Jersey scofflaw’s middle finger or the long arm of the law.

Shyam Patel, 22, decided to test the limits of the First Amendment by flipping off a pair of hero NYPD officers in the middle of Times Square.

The foul expression of free speech landed him in the clink — and he wants the cops to pay for their overzealous enforcement, according to a Manhattan Federal Court lawsuit he filed last week.

The series of events began just after 1 a.m. on May 26, 2016, when Patel was parking his car near Times Square. That’s when Sgt. Hameed Armani and Officer Peter Cybulski ticketed him for the vehicle’s tinted windows.

Just months later, Armani and Cybulski would make headlines when a deranged Queens man threw what looked like a bomb into their patrol van. The two cops drove the apparent explosive device – which experts later determined was a candle and a T-shirt wrapped in tinfoil with solar garden lights – away from the Times Square crowds.

Patel finished parking his car, and he and pal went to sit at the public tables and chairs in Times Square when he spotted Armani and Cybulski eyeing him, he claims.

Patel set his cell phone to record, looked back at Armani and raised his middle finger.

The provocative gesture prompted Armani, Cybulski and other cops to approach Patel and ask for his identification.

Instead of complying, Patel asked, “What crime do you suspect me of committing?”

“You cannot gesture such …” Armani told him, according to Patel’s lawsuit against the two officers.

“Oh yes I can, it’s freedom of speech,” Patel insisted.

“No it’s not, you can’t curse a police officer,” said Armani, who then allegedly grabbed Patel, took his phone and again demanded Patel’s ID.

Courts have found profanity, even when directed at police, is protected by the First Amendment and the New York Civil Liberties Union told The Post no law prohibits cursing at a cop, or giving them the middle finger.

Patel was cuffed and spent 22 hours awaiting arraignment on disorderly conduct and resisting arrest charges, he said. The case was later dismissed.

He seeks unspecified damages. The city said it would review the complaint. The NYPD declined comment.