The NYPD has busted an alleged serial subway creep who masturbated in front of transit workers — a week after Mayor Bill de Blasio echoed an NYPD call to ban rail recidivists.

Cops nabbed 31-year-old Derel Rice — who has a long rap sheet of subway sex crimes — for trapping an MTA worker inside station booths and masturbating in front of their window, police said.

“He’s a menace,” Sgt. Christopher O’Connell, commanding officer of the Transit Special Victims Squad, told The Post.

“He’s terrorizing booth clerks. He holds them hostage in their own booth, they can’t leave because he’s standing there,” he explained. “He’s literally terrorizing these young women as they go to work.”

Rice was busted last Thursday after surveillance video showed him outside a booth at Brooklyn’s Atlantic Avenue–Barclays Center station, where he exposed himself to the 54-year-old woman inside a booth and masturbated while staring at her, police said.

He allegedly pulled the same foul stunt the week before at the Franklin Avenue station, harassing a 39-year-old booth worker and then hopping the turnstile, the NYPD said.

He was arrested and charged with two counts of public lewdness.

Rice, who has 34 prior arrests, is the latest in a string of transit creeps who continually torment straphangers — a trend that has prompted the NYPD to call for such offenders to be barred from riding the rails.

“We all devote so much time and effort, and these guys get right back out and they go back to doing what they do — which is preying on innocent civilians,” O’Connell said.

The lack of permanent solution to keep serial sickos out of the subway is irking the cops assigned to police them, he said.

“It’s very frustrating, not only for us but for officers in the transit districts,” O’Connell said. “But it’s more frustrating for people going to work, bringing their children to school. It’s a horrifying fact of life that they have to deal with right now.”

Earlier this month, Gov. Andrew Cuomo called for a lifetime ban — and Hizzoner came out in support last week.

“If someone is a threat to others — as long as it’s done while respecting constitutional rights — I think it’s a real proposal that needs to be looked at,” de Blasio told NY1’s “Inside City Hall.”

While political pressure for such a law grows, O’Connell and his squad keep tabs on the same serial transit creeps, tracking their movements through the subway system and responding to tips.

“We’ve had such great success with the public helping us,” he added, citing Crimestoppers and the NYPD Twitter account as crucial in catching the repeat pervs. “I just hope that this ban comes to fruition.”