A Northeast Washington man serving 18 years to life in federal prison for rape was released accidentally by a deputy sheriff Thursday after he appeared in Montgomery County Circuit Court for a bond hearing on new rape and kidnaping charges.

The man, Bernard D. Smith, 29, was one of two prisoners deputies brought to the courthouse lockup after their appearances before Judge Irma S. Raker. Smith was to be transported to the Montgomery Detention Center, while the second man was to be released on bond, according to Sheriff James Young.

"The deputy working as the jailer just inadvertently released the wrong man," Young said yesterday. "We discovered the mistake three minutes after it happened, but by then the prisoner had disappeared."

Young said the foul-up was the first of its kind in his department. "We handle thousands of prisoners a year and we've never had anything like this happen before," Smith said. "We're doing everything we can to apprehend him."

Smith, who was still at large yesterday, was returned to Montgomery County this week from Butner federal prison in North Carolina to face charges that he abducted and raped a 30-year-old Bethesda woman in 1980.

Judge Raker scheduled Smith's trial for Dec. 6 and set a $150,000 bond which was to have been imposed should he become eligible for release from prison before his trial.