A half-dressed female NYPD lieutenant was caught in a drunken, on-the-job sex romp with a male sergeant at a Manhattan police building Saturday night, sources said.

Lt. Brandi Sanchez, 39, and Sgt. Lambros Gavalas, 46, were stripped of their guns and badges for the alleged rendezvous in a department bathroom inside a building used by NYPD personnel at 90 Church St., the sources said.

The 39-year-old lieutenant lives with and has a child with the commanding officer of Brooklyn’s 79th Precinct, Deputy Inspector Timothy Skretch — though that’s not the man she was allegedly caught with, sources said.

The NYPD did not deny the allegations and said the incident is under internal review.

A separate NYPD sergeant first noticed Sanchez, who is assigned to the Family Assistance Section, and Gavalas “occupying a closed stall, apparently engaged in what were believed to be sexual interactions,” according to a department report obtained by The Post.

The pair were caught five minutes before Sanchez’s shift was scheduled to end, the report says. Family Assistance Section has offices in the Tribeca building.

The sergeant left the restroom and reported what she witnessed to another department lieutenant, who entered the bathroom and told the couple to scram.

When the officers who found the couple returned to the bathroom shortly after, the alleged lovers were still in the stall, the report noted.

At that point, the lieutenant again ordered them to leave and Gavalas walked out without saying a word.

Once he left the bathroom, the female sergeant entered the adjacent stall, climbed up on a toilet seat and peered over a partition to find a still-exposed Sanchez.

Sanchez identified herself as a cop as she finally left the stall, wearing a black coat, burgundy dress and black shoes.

She was not armed at the time of the alleged rendezvous and was “unable to be interviewed due to her compromised mental state,” the department record states.

Sanchez and her paramour were both placed on modified duty, sources said.

Sanchez could not immediately be reached for comment.

The unit where she is assigned offers peer counseling to members of the department experiencing stress on the job.