A man was slashed in the face for refusing to give up his cellphone during a robbery, cops said Tuesday.

The attack happened around 2:30 p.m. Saturday on a Brooklyn-bound B train, police said.

An unidentified man tried to snatch the 31-year-old subway rider’s cellphone while the train was stopped at the Pacific Street station, cops said.

When the commuter refused to give it up, the man slashed him on the left side of the face with a straight razor, then fled in an unknown direction.

The straphanger was taken to New York Presbyterian Brooklyn Methodist Hospital, where he received stitches.