A man has been charged with raping a 15-year-old girl whom he had allegedly held against her will for a month at a house in Sydney's west.

The teenage victim met her alleged attacker, Rashadul Islam in a random encounter after leaving her residential out-of-home care facility last month.

She was then reported missing by the facility, located in Sydney's west, but was not seen again until the early hours of Thursday morning.

About 1.30am on Thursday, police saw her allegedly being chased down Balmoral Street, Blacktown, by Mr Islam.

Officers allegedly saw the 29-year-old grab the girl and try to drag her away before they intervened and took him to Blacktown police station.