CUNY just can’t seem to keep pervy profs off the payroll.

In a shocking Brooklyn federal court lawsuit, a female undergraduate claims her human-anatomy professor at LaGuardia Community College, Hany Fam, offered her good grades for sex.

The case comes on the heels of bombshell allegations that professors at CUNY’s John Jay College of Criminal Justice raped and tried to pimp out students and used and sold drugs on campus. The widening scandal, now being probed by the Manhattan D.A.’s office and the state Inspector General, was first revealed last month by The Post.

In the lawsuit, the 40-something student, going by the pseudonym Jane Doe, claims she asked Fam for a meeting in October 2017 to discuss grades. The prof, 60, insisted they meet at her apartment, court papers say.

“Fearing that she would offend her professor and perhaps jeopardize her grade in his class, [she] finally relented,” the suit says.

Fam arrived at her Brooklyn apartment and gave her a bottle of wine and a kiss on the cheek, court papers say. He sat on the couch and told her he was “lonely” and had “problems in his marriage,” the suit claims.

He “unbuttoned his shirt to reveal a scar and claimed to have a heart condition that left him with just a few years to live,” the suit says.

The student “got up and went to the kitchen, but Professor Fam followed her, leaned in to hug her, and told her to relax,” court papers say.

After pouring two glasses of wine — which the woman claims she refused to drink — Fam “said that he could make things much easier for her, and repeatedly asked if she would be his ‘friend,’” court papers say.

When the woman asked if “friend” was code for “sex,” he confirmed it was, according to the lawsuit.

“He suggested they meet once a week and told [her] it wouldn’t be ‘that hard’ for her because of his heart condition,” court papers say.

Taking his pitch one step further, Fam said other professors have similar arrangements with students, according to the lawsuit.

When the student made “unambiguous . . . expressions of disinterest,” the prof “became aggravated and told Plaintiff that she was too uptight,” the lawsuit says.

On his way out, Fam handed her “what appeared to be questions and answers for the following day’s scheduled quiz and told [her] to think about his offer.”

The woman did not return to Fam’s class and reported him to the college’s Title IX office, which handles sexual harassment complaints.

The college concluded that Fam “offered [her] a good grade … in exchange for sexual favors,” according to the lawsuit.

A LaGuardia spokeswoman told the Post the professors’s last day in the classroom was the day the student’s complaint was filed, Nov. 7, 2017, and that he was terminated on Jan. 11, 2018. He is “not eligible to work at LaGuardia any time in the future,” said spokeswoman Elizabeth Streich.

The public college located in Long Island City, which offers two-year associates degrees, also agreed to provide counseling for the woman, cover the costs of her course materials and re-enrollment in the class, but did not remove her “withdrawal” from the class on her transcript.

The woman — who is being represented by Carrie Goldberg, the Brooklyn lawyer backing at least two Harvey Weinstein accusers — claims her life has taken a dark turn because of the “emotional stress” of the ordeal. She “has even felt unsafe in her own home because Professor Fam knows where she lives,” the suit says.

The plaintiff told the Post she wants to maintain her anonymity because she is “scared of the repercussions.

“He’s obviously not a nice person, so I don’t know what lengths he might go to. It’s scary for a single woman who lives alone.”

She is seeking unspecified damages and a jury trial.

Court papers also claim Fam was part of a “wider culture of similar behavior by LaGuardia professors.”

In a review for Fam on the Rate My Professor website, a student wrote in October 2017 that he “wastes time on dirty jokes . . . I don’t know how to respect a professor who cracks dirty jokes all the time.”

Fam has been a lecturer at LaGuardia Community College and an adjunct associate professor at CUNY’s York College in Queens since at least 2012, according to SeeThroughNY. He earned $35,000 last year from LaGuardia and $14,000 from York.

Fam could not be reached for comment.