Three of the city’s longest-running “rubber room” teachers have raked in more than $1 million each for a decade of not working in classrooms, and a fourth is paid a top salary — $100,049 a year — not to teach.

The Foul Four — who beat sexual-misconduct charges — can’t be fired by the Department of Education because they are entitled to job protections under state tenure laws, which require “due process.” Educators are entitled to a trial with an independent hearing officer who decides whether any misconduct warrants termination.

A group of New York City parents filed a lawsuit this month seeking to loosen the restrictions after a California judge ruled teacher tenure in that state unconstitutional.

The four banned teachers collect a total of $363,271 a year, plus pension and health benefits.

“If we don’t have trust for someone to be around students, they shouldn’t be a teacher,” said Timothy Daly, president of The New Teacher Project, a nonprofit that works with schools. “Thank God we’re not putting them back with students, but we’re forced to keep paying them indefinitely.”

The DOE said the teachers work in offices on various tasks.

“The decision to permanently ­reassign an employee is a last resort, and taken seriously,” said spokesman David Pena.

Meanwhile, the four have gotten automatic longevity raises and stand to get further raises — and back pay — under the $9 billion United Federation of Teachers union contract ratified last month.

The highest-paid is Angel Salazar, 54, who makes $100,049 a year but hasn’t taught since 2010.

As a history teacher and tennis coach at William Cullen Bryant HS in Queens, Salazar improperly touched two girls and made sexual comments to them, according to Richard Condon, the special commissioner of investigation for city schools.

One girl told probers she was speaking with Salazar alone in June 2010 when he pulled her close and pushed against her with an erection, Condon reported.

Salazar often told the girl she was beautiful and “wanted [her] to be his wife,” Condon said. Salazar allegedly gave her his phone number and said he was jealous of a student she was dating.

When the DOE sought to fire him, the hearing officer found some witnesses “not credible” and dismissed the case, the department said.

Other teachers the DOE fails to fire are sent to a pool of substitutes. They include James Rampulla, an $86,590-a-year teacher at MS 172 in Queens who let a 14-year-old student drive his car, gave him pricey gifts and exchanged hundreds of text messages with him. Although some of his texts to the boy read, “I love you,’’ Rampulla was found not guilty of sexual misconduct.

UFT president Michael Mulgrew said the union “believes in zero tolerance on the issue of sexual misconduct with children” and that those found guilty must be axed.