The accused, identified as Vikram, was in an inebriated condition when the incident took place last night, and was nabbed by a constable who was present at the spot.
Vikram works at a printing press in Civil Lines and resides in Sabzi Mandi area.
The woman is a student at a private university here.
"The incident was reported to police around 10 PM. The victim had gone to buy vegetables in the market when the man caught her from behind," a police official said.
As the woman raised an alarm, the beat constable who was posted nearby came to her rescue and nabbed Vikram. He later brought him to the police station, he said.
"A case under section 354 IPC (outraging the modesty of a woman) has been registered at Sabzi Mandi police station," said Deputy Commissioner of Police (North) Madhur Verma.
Vikram was produced before the court today and has been sent to judicial custody.