Maybe the most shameful feature of the New York City public school system — its infamous network of “rubber rooms” — will soon be history.

The Department of Education and the United Federation of Teachers yesterday announced that the rooms — essentially detention centers where teachers accused of misconduct while away months and years at full pay — will be eliminated entirely come the fall.

For more than three years, The Post doggedly campaigned against the rubber rooms — where hundreds of teachers and administrators got paid for doing absolutely nothing, at a cost of $40 million a year in salaries alone.

Like Alan Rosenfeld, the typing teacher who collects $100,000 a year and spends his days practicing law and overseeing an $8 million real-estate portfolio after making lewd comments to teen girls. He’s been in a rubber room since 2001.

And his story is hardly the exception.

The DOE created the rooms as a dumping ground for teachers awaiting charges or hearings in order to get them out of the classrooms. But onerous contract clauses have prevented DOE from dealing expeditiously with the charges.

Under the agreement, accused teachers will be reassigned to non-classroom duties while their cases are pending.

Those accused of serious crimes will be suspended with pay; those accused of the most heinous crimes can be suspended without pay.

DOE also agreed to file incompetence charges within 10 days and misconduct charges within two months. Any teacher not charged in that time period would return to the classroom.

More arbitrators will be hired — and their caseloads increased — so that hearings are concluded within 60 days.

As always, the devil is in the details.

The agreement essentially mirrors the suggestions made by UFT President Michael Mulgrew for eliminating the rubber rooms in a Post column published two months ago. (Obviously, it’s easier to get the union’s full cooperation if you agree to much of what it demands.)

Still, accused teachers deserve timely due process, and that’s what this deal is meant to provide.