The filthiest thing about the city subway system actually might not be its train cars — at least when these prolific perverts are riding the rails.

A dirty dozen transit deviants are driving subway sex crimes through the roof with their refusal to stay away, arrest after arrest, leaving the cops who are tasked with policing the pervs frustrated by the lack of a more permanent solution.

The creeps “wake up in the morning for one purpose, and that is to commit these crimes,” one high-ranking NYPD insider said of the worst offenders.

“I’ve had [the pervs] tell me, ‘I think she likes it,’” one official said of the subway sickos.

Among the rogues’ gallery of grinders, gropers and public masturbators, the most persistent is James Hunt, who allegedly has a penchant for touching himself while sucking his thumb in front of riders. He has a total of 78 arrests, 32 for transit sex crimes, according to sources.

Hunt, 41, has been busted for 26 subway sex crimes within the past decade alone — and, as a second high-ranking source put it, “That’s just how many times he’s been caught.”

Then there’s James Peterson, 46, known for allegedly exposing himself and rubbing against the rears of unsuspecting women, sources said. He’s been arrested 22 times, half of them for transit sex crimes, according to sources.

Peterson shares an alleged modus operandi with Ronald Dudley, 40, who has been arrested nine times, including for seven sex crimes — most recently on Valentine’s Day for allegedly rubbing against a 9-year-old girl aboard the 7 train.

There’s also Roger Reid, 58, whose record of 32 total arrests — including 20 sex crime busts, mostly for forcing his hands down commuters’ pants — is so well-known that he was featured in a January 2016 Post story about the NYPD’s push to ban transit recidivists from the system for life.

Reid is one of five Level 3 sex offenders among the dirty dozen. Level 3 means they are the most likely to be repeat offenders. Four others are Level 2 sex offenders, the next-highest-risk group.

Sources say the NYPD is dealing with turnstile justice because the most common subway sex crimes — including forcible touching, persistent sexual abuse and public lewdness — are misdemeanors, meaning the creeps are often quickly cut loose to strike again.

Police sources on the front lines of the fight against the sex crimes scourge say they have been pushing for a lifetime ban for serial offenders for years but that the proposal has struggled to gain traction amid arguments that even perverts have a right to public transit.

With no authority to bust known perverts simply for being in the subway system, cops say they are caught in the agonizing position of having to wait for the fiends to strike again before moving in.

“It’s a challenge we face,” a third source said. “We spot people we know are going to do this and we have to follow them until they spot another victim. We have to wait until they victimize someone else.”

The second source added, “Why wouldn’t the sanctions go up? Why do we have to have a woman or a kid traumatized for life [because] we couldn’t step in earlier?”

Still, as frustrating as the waiting game can be, the repeat offenders’ refusal to stay away from the transit system gives cops good practice, teaching them exactly what to watch out for.

“The individual who’s looking to commit the crime is looking at who’s around, letting trains go by,” said the first source, a department veteran of more than 10 years. “They look for that very precise time where they feel nobody is watching and they’re going to be able to commit the crime.

“They all like the express trains because it’s a longer train ride” between stops, so there’s less opportunity for potential victims to escape during an assault, according to the source.

Also, the criminals “prefer the front car … It’s crowded in the front,” the source said.

The NYPD’s plainclothes perv patrols often work in teams of three, according to sources.

When an officer believes a crime is going down, one of the undercover officers will pull the victim off the train at the next stop for an interview while their partners stay on the suspect, the source explained.

If the victim offers a strong enough narrative to press charges, the cop on the platform will signal or radio his two partners to cuff the suspect.

“They’re creeps. They prey on the innocent. They prey on women,” said the source — adding that the miscreants aren’t always the usual suspects.

“These are family men, too. They have wives, they have kids,” the source said of some fiends. “They say, ‘Please don’t tell my wife.’”

Even with subway sex crimes in decline overall, the faces of suspects often look the same.

“It’s a very small group of perpetrators that drive the crime on our subways,” said the second source.

In addition to an insatiable need for gratification, the perverts are emboldened by the lack of deterrence against returning to the trains, sources said.

Additional reporting by Danielle Furfaro