A man was arrested yesterday for allegedly committing two knifepoint rapes in a Brooklyn housing project – as two of the cops who were supposed to be watching the building were stripped of their guns and badges, police sources said yesterday.

Thomas Boker, 29, of Jerome Street, was linked by forensic evidence to the sex assaults Thursday and on March 6 at the Van Dyke Houses in Brownsville, the sources said.

Boker was charged with rape, assault and robbery, among other charges, cops said.

He was taken to Kings County Hospital for psychiatric evaluation after he began acting erratically, police sources said.

In both of the terrifying incidents, the victims were accosted in elevators and dragged into stairwells by a knife-wielding sex fiend.

Parts of the frightening assaults were caught on tape by building surveillance cameras.

Two cops who were supposed to be patrolling the stairwell in the earlier incident were stripped of their guns and badges after the cameras showed they hadn’t actually done the security sweeps, police said.

The unidentified cops still face further disciplinary action, sources said.

There was no indication, however, that other cops monitoring the building’s surveillance video feeds witnessed either of the attacks, sources said.

Also, none of the images that have been captured from the footage shows a rape occurring, police sources said.