Prosecutors across the city are using secret spreadsheets to identify cops who could have trouble on the witness stand because they’ve been sued, arrested, accused of misconduct or testified suspiciously in the past, sources told The Post on Monday.

District attorneys offices in Manhattan, Brooklyn and The Bronx have maintained internal databases for several years, while the Queens DA’s Office created one last year and the Staten Island DA’s Office is developing one, sources said.

The issue is currently the subject of a court battle being waged by a former Manhattan prosector-turned-defense lawyer who’s suing to get a copy of the list maintained by Manhattan DA Cyrus Vance Jr.

Lawyer Andrew Stengel alleges in his Manhattan Supreme Court suit that cops who were flagged for “adverse credibility findings” were referred to prosecutors as being “on the office’s ‘naughty list.’ ”

Stengel declined to comment, but former Manhattan prosecutor Nuala O’Doherty told WNYC radio — which first reported on the lists Monday — that the “bad cop list” included criminal convictions, past false statements and information on pending investigations.

“You can get everything,” O’Doherty said. “I mean, you can get, ‘An officer was arrested for a DWI, driving while intoxicated.’ You could get, ‘The officer signed a statement that proved to be false,’ you can get that the officer swore to a complaint, a written statement, and that was then later found on video not to be true.”

Eugene O’Donnell, a professor at John Jay College of Criminal Justice, said he was troubled “that this is being done by so-called progressive prosecutors” and questioned whether “this is just another way to not prosecute people.

“You can’t have a list like this and not have a whole list of collateral questions,” said O’Donnell, a former NYPD cop and Queens prosecutor.

“What are the criteria to get on this list? What are they doing here? Are you formally notifying Internal Affairs . . . and is there a hearing?”

The head of the NYPD Patrolmen’s Benevolent Association also said that prosecutors “have access to police officers’ records because they are legally required to produce relevant information in criminal trials, not so that they can help anti-cop advocates with their campaign to demonize police officers.

“The only way a police officer can avoid being tagged with a false ‘red flag’ will be to avoid taking enforcement action,” PBA President Pat Lynch said. “That will not result in a safe city.”

The NYPD said it’s been working with both state and federal prosecutors since 2016 to find out whenever “there is a judicial adverse credibility finding with respect to an officer’s testimony.

“The Department closely evaluates these findings and takes appropriate action including re-training, an evaluation of the officer’s assignment and, where warranted, a referral to [the Internal Affairs Bureau] for investigation and discipline,” the NYPD added.