Video surveillance clearly shows the woman entering the single-occupancy bathroom late Saturday, soon followed by a man believed to be in his 30s, police sources say.

They remained in the bathroom for about eight minutes. That’s when the alleged rape took place, sources said. The suspect exited the bathroom, then walked back in.

The woman, who was believed to be heavily impaired by alcohol and possibly prescription pills, alerted friends and called 911 a short time later, sources said. She was taken to Lenox Hill Hospital for treatment.

Sources said the suspect regularly patronizes the Christopher Street bar on Saturday nights and may have been dealing drugs there.

“People inside the Stonewall know him,” Chief of Detectives Robert Boyce said. “We hope to have him identified in the next coming days.”

Stonewall Inn, site of the Stonewall riots of 1969, is famed as the birthplace of the modern gay rights movement.

“It’s a very disturbing incident taking place in a site that’s very important historically, where something good happened in terms of creating more opportunity for people to live their lives,” Mayor Bill de Blasio said, “and to see a violent incident like this is very troubling.”