A man wanted on rape and kidnaping charges held Montgomery County police at bay at a Silver Spring apartment building for 7 1/2 hours last night and early today before finally surrendering peacefully at 2 a.m.

Other residents at the three-story Belfiore Apartments at 8904 Manchester Rd., Silver Spring, were evacuated as police surrounded the building about 6:30 p.m. and began negotiating over the telephone with the suspect, William B. Freitag, 31, of Laurel.

Freitag was wanted on charges of rape, kidnap and assault with intent to maim a 23-year-old woman on Dec. 1. He was arrested on these charges, then released on bond on condition that he undergo psychiatric evaluation at Washington Adventist Hospital. Montgomery County police said he has been sought since mid-january when he allegedly walked away from the hospital.

Police said they traced Freitag to the Silver Spring apartment last night and attempted to enter it with a key but found that the door was chained shut. At that point, they said Freitag announced he had a gun and threatened to kill himself.

A police negotiating team led by Chief Bernard D. Crooke Jr. stayed in touch with Freitag throughout the night and early morning hours and finally persuaded him to surrender after promising a fair trial, a police spokesman said.

The spokesman said a woman who had been in the apartment with Freitag also was charged with kidnapping in the Dec. 1 incident.