Three strikes and he wasn’t out.

At the beginning of his 32-year career as a math teacher in Queens, Francisco Olivares allegedly im pregnated and married a 16-year-old girl he had met when she was a 13-year-old student at his Corona junior high, IS 61, The Post learned.

He sexually molested two 12-year-old pupils a decade later and another student four years after that, the city Department of Education charged.

But none of it kept Olivares, 60, from collecting his $94,154 salary.

He hasn’t set foot in a classroom in seven years since beating criminal and disciplinary charges. Chancellor Joel Klein keeps Olivares in a “rubber room,” a district office where teachers accused of misconduct sit all day with nothing to do.

The DOE insists it can’t get rid of him. “The department’s hands are tied by state law and union rules,” said spokeswoman Ann Forte.

She said tenured teachers can be fired only if an arbitrator approves.

“The department twice tried to terminate this teacher, and both times, an arbitrator decided to keep him on the payroll,” she said.

Most of the 660 rubber-room teachers on the city payroll are awaiting disciplinary proceedings, but Klein has exiled “a handful” of duds like Olivares even though they have been legally cleared to return to class.

Last week, The Post reported that typing teacher Alan Rosenfeld, 64, was banned from the classroom in 2001 for allegedly making lewd comments to and leering at girls at IS 347 in Queens. Raking in $100,049 a year, he has spent time in a Brooklyn rubber room working on his law practice and overseeing more than $7 million in real-estate investments.

Olivares has an even worse record. The Queens district attorney charged him with abusing two 12-year-old students in school, one in December 1988 and the other a month later.

He showed one girl porn pictures and photographed her in suggestive poses with her pants down, the DA charged. Another accused him of rubbing against her from behind.

A jury found him guilty, but his conviction was reversed on appeal on technicalities. The DOE held an administrative trial on the charges, but a panel of arbitrators voted 2-1 in favor of Olivares. They sent him back to IS 61.

He struck again, according to Special Schools Investigator Richard Condon, who recommended firing him. In 2002, Condon found Olivares had backed a girl against a wall and caressed her arms while urging her not to transfer, saying, “I’m becoming very fond of you.”

After a hearing, an arbitrator let Olivares off with just a warning not to stand close to students.

This time, Klein refused to return Olivares to the classroom. The teacher sued in 2004 to have his records expunged.

It was then that DOE officials dug up accusations from 1978 that Olivares had a sexual relationship with a former IS 61 student he had met when she was 13 — and got her pregnant at 16, according to records filed in Manhattan Supreme Court in the 2004 suit.

Olivares, then 30, married the teen and falsified DOE forms to get her health insurance sooner, it was alleged.

DOE officials could not explain Friday why the department waited until 2003 to formally bring those sex and fraud charges.

Olivares’ student-turned-wife, whose name is being withheld by The Post, could not be reached.

Reached in Georgia, his daughter, now 29, said her parents “have been estranged for so many years.”

“I try to keep in touch a few times a year,” she said of her dad. “I wish I could say something, but I don’t want to go behind his back. My father can do his own defense.”

After separating from his wife, Olivares, at age 50, fathered a son with a 23-year-old, records show.

The teachers union did not defend him.

“The current system works for no one,” United Federation of Teachers President Michael Mulgrew said, adding that the union “has made repeated attempts to work with the administration to resolve the rubber-room issue, but the administration has preferred to grandstand rather than solve it.”