The man was picked up by US Marshals early Thursday morning.
Police believe he may have been involved in a recent rash of armed robberies near the campus.
He's being held on a related charge, but, so far, has not been charged with the rape.
Authorities say a 20-year-old student was robbed and sexually assaulted on the 1400 block of North Carlisle Street, south of campus, last Monday night by a man with a gun.
Surveillance footage shows the suspect boarding a southbound SEPTA subway train at the Broad and Erie station, police said.
The suspect then boarded a train at Broad and Cecil B. Moore, prior to the incident, just a few blocks away from where the attack occurred.
Police say the victim left the library with a friend with whom she parted ways with at Broad and Cecil B. Moore.
The victim told police she heard footsteps behind her as she approached Carlisle, and then a man with a small silver handgun struck her arm and told her not to scream.
VIDEO: Surveillance video released by police
He pushed her up against a wall in a construction area, sexually assaulted her, then fled on foot, police said.
The man's name has not been released.
While police have the man in custody, it may be awhile yet before he faces possible rape charges.
They'll have to get a warrant to collect DNA samples and that will take some time to process.