An NYPD captain who did time at Rikers Island for assaulting his cop mistress on a Greenwich Village street is finally getting booted from his $150,000-a-year job — but will keep his lucrative pension, The Post has learned.

In August 2007, Capt. Alberto Sanchez, 46, was convicted in Manhattan Criminal Court for a September 2006 attack on his subordinate, Sharon Gandarilla, 36, a cop assigned to the 23rd Precinct in East Harlem, where Sanchez was once second-in-command.

Gandarilla, who has filed a federal civil-rights lawsuit against Sanchez and the NYPD, was outraged that Sanchez will keep his pension, which is worth an estimated $75,000 a year.

“It’s a slap in the face to me. It is the NYPD condoning domestic violence,” Gandarilla bitterly noted.

“The mayor is saying the pension system is costing a lot of money and he wants pension reform,” she said. “Meanwhile, the NYPD is slated to give this guy his pension when they could have fired him more than three years ago.”

Legally, a felony conviction leads to an immediate dismissal and loss of pension. But when it’s a misdemeanor, the police commissioner can rule on whether the officer keeps his or her job and pension.

Gandarilla’s attorney, Linda Cronin, of Lake Success, LI, was flabbergasted by what she claimed was lenient treatment the NYPD provided to Sanchez.

“I suspect that rank has its privilege. It’s mind-boggling to believe that the NYPD will protect him to this degree,” she said.

Gandarilla, a mother of three, asserts that she was sexually harassed and repeatedly beaten by Sanchez, who forced her to perform sexual favors for him at work after she sought to break off a consensual affair that began in August 2004, when she was still married.

A jury found Sanchez guilty of misdemeanor assault for attacking Gandarilla on Lafayette and Fourth streets, rejecting his alibi that he was already on a Metro-North train heading home to his wife and kids.

Sanchez was sentenced to 60 days in jail after a series of appeals.

He spent 40 days at Rikers Island last spring, with the balance of his term forgiven under the so-called “good time” provisions of state law, a city Department of Correction spokesman said.