A 20-year-old man was charged Tuesday with trying to rape a woman inside her Gramercy area apartment building over the weekend.

The man, Dominique Brown, was charged with first-degree rape, second-degree burglary and sex abuse.

Brown, who lives in East Harlem, is accused of following the 25-year-old woman into the building and trying to rape her in the vestibule at about 3:30 a.m. on Saturday. But the woman fought him off and he ran.

Brown was awaiting arraignment Tuesday and could not be reached for comment. Brown has several prior arrests, including a 2013 arrest for sex abuse and a forcible touching charge, which is sealed. Other arrests include criminal trespass, marijuana possession and not paying the fare on public transportation.