Apedelrazak Badram, 32, has been charged with three sexual offences and two counts of impersonating a police officer, Scotland Yard said.
The girl was raped near Sandhurst Road in Edmonton, north London, on Wednesday.
Detectives said it was linked to a second attempted assault on another 12-year-old girl the same day.
The girl attacked in nearby Shirley Grove managed to escape.
Mr Badram, of Enfield, north London, is also charged with false imprisonment, two counts of breaching a sexual offences prevention order, possession of class B drugs and theft.
He appeared in custody at Highbury Corner Magistrates' Court on Saturday and will return to court next week.
A man has appeared in court accused of raping a 12-year-old girl at knifepoint and claiming to be a police officer.