Police are searching for a man who allegedly tried to rape a woman on the subway.

The woman was riding the northbound 3 train at about 4 p.m. on Thursday when she said she noticed the suspect masturbating, police said.

She told police she moved to another car, but he followed her and tried to rape her, police said she told them.

The man ran away at the 148th Street station in Harlem, police said Sunday.

Police released a sketch of the suspect (above).