Sent to a “rubber room” for alleged improper conduct with a student, this teacher just couldn’t keep his hands off himself.

Ian Millman filmed himself masturbating and sent the dirty video to a different student, a girl he mentored and began an affair with at World Journalism Preparatory School in Flushing, Queens, when she was a sophomore, school investigators charge.

The sleaze didn’t stop there for Millman, the school’s dean of discipline. Before his days in the rubber room, he pleasured himself in his office and filmed it, investigators found.

The 40-year-old married father exchanged 132,000 text messages and calls with the female student, had sex with her for several years, got her pregnant and paid for her abortion, says a report by Special Commissioner of Investigation Richard Condon, which The Post obtained through a Freedom of Information request.

“Millman constantly promised [the student] that he was going to divorce his wife and marry her,” the May 2015 report says.

He told investigators that he got to know her after the school guidance counselor asked him to speak with the girl, who was depressed and not talking to anyone. He said the girl was a sophomore, but documents do not reveal her age.

As an “​​academic intervention specialist,​”​ Millman was assigned to help students who were skipping class or had personal or academic issues. He is also a baseball coach and an associate scout for Major League Baseball.

“I’m the fireman. When the bell rings, I slide down the pole and get into action,” he said of his job in a 2010 interview with a Columbia Journalism School publication.

Millman and the girl first kissed after a fall parent-teacher conference, when he drove her home​​, and they first had sex around Christmas, she told probers.

“Millman drove her to Jones Beach on Long Island, where they had sex in the back seat of his car,” Condon’s report says.

She then had sex with the teacher almost daily, including at school, at his friend’s home, in a motel and at his parents’ house, the report says.

She got pregnant and told Millman, who was “very upset” and demanded she get an abortion, the report says.

“He drove her to a Planned Parenthood clinic in Queens, waited outside while she had the abortion and then drove her home,” the report says.

The girl said Millman warned her “not to tell anyone about the relationship with him because he could get into a lot of trouble.”

‘[Millman] drove [the student] to a Planned Parenthood clinic in Queens, waited outside while she had the abortion and then drove her home’ - report by Special Commissioner of Investigation Richard Condon

She even went solo to ​her prom because she considered herself in a relationship with Millman.

“After the prom, Millman brought her to his parents’ home where they had sexual contact in his old bedroom,” the report says.

Condon’s investigators got wind of the misconduct in October 2013 — after the student had graduated — and found more than 100,000 “phone contacts” between the two over 2 ¹/₂ years.

Millman ​claimed he called the girl “most mornings to inspire her to get up and go to school.”

At the time, the student and her mother denied the relationship was inappropriate.

The report says Millman, through his lawyer, declined to speak to investigators. He paid a $1,000 fine to the Department of Education to settle the matter.

In 2014, Condon’s office probed Millman again — this time for an alleged relationship with a different student in a case that wasn’t substantiated, records show.

He was exiled to a rubber room​, where accused educators await hearings, from​ November 2014 to January 2015 and filmed the dirty video while there​, Condon found.​

A third investigation began in January 2015 after the first student’s mother reported that her daughter lied in the earlier probe.

Millman, who was paid $77,913 in 2015, quit his job in April of that year and surrendered his state teaching license.

Condon’s report does not mention criminal charges but recommended Millman “continue to be ineligible for work with the DOE.”

Millman runs the New York Nine, a baseball-coaching nonprofit. ​

He did not return requests for comment.

There’s more female teachers sleeping with their students than you thought:

Additional reporting by Aaron Short and Kathianne Boniello