Quinshon Shingles, seen in the studio (left) and demonstrating the rhymes the rapper said he was forced to perform for cops under threat of arrest. Shingles is suing the NYPD, calling the cops alleged actions "humiliating."

A Brooklyn man says he was forced to rap for a crew of NYPD cops to get out of handcuffs — and warned that if his rhymes weren’t “hot’’ enough, they wouldn’t free him.

Quinshon Shingles’s coerced ditty about booze, “bitches” and weed was good enough to get him released — and enough to prompt a scathing Brooklyn Federal Court lawsuit.

“I felt like they were humiliating me,” said Shingles, whose rap name is “Sauce Da Boss,” to The Post on Tuesday.

“They were all Caucasian officers, and I’m a black man, and they had me performing for my freedom. I was really upset.”

Shingles, 28, said he, his cousin and another male pal were at the cousin’s East New York home in December 2011 when the plainclothes officers arrived demanding to perform a search, the suit states.

The cousin, Tyriek Fortune, was suspected of a criminal offense, the suit says, although it’s unclear exactly what the alleged crime was.

One of the cops, David Grieco, is already under investigation for illegal entries elsewhere.

Fortune’s mom, Donyale Kitchens, refused to allow the cops in without a warrant, and the officers agreed to come back later, the suit says.

But instead of getting a warrant, the officers convinced a building super to give them keys to the pad, according to the suit.

Once inside the home, the officers then handcuffed Shingles, Fortune and the third man while they did a search, the suit states.

Then, the cops allegedly decided to break for a musical interlude after learning that Shingles was an aspiring rapper.

“They said, ‘Rap something if you want to go home,’ ” Shingles said. “I was scared. I was nervous. I didn’t want to got o jail.”

Shingles said he was handcuffed on the ground and leaning against a couch when he recited lyrics from an obscenity-laced party song he penned a couple months earlier. The cops approved of the rendition and let him walk, according to the suit.

His non-rapping pals remained cuffed.

The search of the apartment did not turn up any illegal items, the suit states.

Kitchens and Shingles are now suing the NYPD for illegal search and false imprisonment for an undisclosed sum.

An NYPD spokeswoman declined comment, saying the department hadn’t seen the lawsuit yet.

A few months earlier, Fortune had won an undisclosed settlement from the NYPD after he claimed he was falsely arrested on trumped-up gun-possession raps, court papers show.

Grieco is part of a team of NYPD officers who have been hit with a slew of lawsuits over illegal searches and theft, records show.