A man snuck into a woman’s bedroom through the fire escape of her Brooklyn apartment and tried to get in bed with her, police said.

The man entered the third-floor apartment through a window of the building on Greene Avenue, near Irving Avenue, in Bushwick at about 6:45 a.m. on Saturday, cops said.

The woman, 30, woke up to find the man exposing himself, police said. He then tried to get in bed with her, but she screamed and her roommate ran into the room, police said.

The man fled the apartment and ran out the front door of the building, police said.

The woman was not hurt, cops said.

The incident is being investigated as an attempted rape. No arrests have been made and the investigation is ongoing.