A man who spent 16 years in prison for a murder that he was charged with at age 14 — only to have the conviction overturned — is now suing the city and tarnished former NYPD Detective Louis Scarcella in federal court.

John Bunn said he was home sleeping at the Kingsborough Housing Project in Brooklyn in 1991 when a corrections officer was killed and another wounded outside — and in his underwear eating breakfast cereal the next morning when Scarcella and his partners burst in and busted him.

Bunn’s is one of 14 cases worked by Scarcella from the 1980s and ’90s — occasionally with partner Stephen Chmil — that have been thrown out because of “questionable tactics.”

Eight cases were overturned by the Brooklyn DA’s Conviction Review Unit, with another six thrown out by judges, including one who overturned Bunn’s conviction in 2016.

According to Bunn, he was convicted in 1991 primarily on the testimony of the wounded jail guard, which he said was coerced by the cops — and that the victim may have been on drugs or “inebriated.”

He said the officer first described the suspect as “a light-skinned black man in his twenties” — and Bunn is dark-skinned, 5 feet 2, and was only 14 at the time.

Bunn was taken to the 77th Precinct stationhouse and “put into a small locked room and handcuffed to a pole,” according to the 48-page complaint filed this week in federal court in Brooklyn.

He was convicted by a jury after a trial that lasted just over one day, despite having no physical evidence that linked him to the shooting outside the housing project.

He claims the NYPD already knew that detectives, including Scarcella and Chmil, were violating police procedures and making tainted busts.

Bunn was paroled in 2009, and, in 2016, burst into tears in court when told he had been cleared.

The lawsuit accuses the cops and the city of malicious prosecution, denial of due process and civil rights conspiracy.

Scarcella declined to comment and referred The Post his lawyers. Chmil did not immediately return calls for comment.

The city law department declined to comment on the case.