A man sought by D.C. police for nearly 17 months before he was arrested Wednesday was promptly released the same day by a judge who was never told the circumstances of the case.

Superior Court Judge John R. Hess said yesterday he never would have freed William David Ferguson prior to his trial date if he had been aware that Ferguson had eluded police a number of times since he was charged with the February 1979 holdup of a Northeast Safeway store.

Ferguson, 31, who was listed as one of the city's 10 most-wanted suspects for the last six months, was released by Hess into the custody of Stepping Stones an organization that acts as an intermediary between the court and defendants freed prior to trial and is responsible for their appearance at court proceedings.

District of Columbia law requires that persons charged with crimes be released before trial on personal or money bond or into the custody of third parties, such as Stepping Stones, unless there is a genuine reason to believe that the suspect poses a danger to the community or that he might not appear for his next court date.

In Ferguson's case, neither prosecutors nor the D.C. Pretrial Services Agency, which makes recommendations on the conditions for the release of defendants, told the judge that police traced Ferguson to several local addresses during the last year but "always just missed him."

The U.S. attorney's office said yesterday it is trying to determine why Assistant U.S. Attorney Marc B. Tucker, who is prosecuting the case, did not tell Hess that Ferguson had eluded police for so long, even though it would have had a bearing on whether Ferguson should be released.

The judge said yesterday "There was absolutely nothing in the papers which were before me or any representations made" to indicate that Ferguson had been avoiding police and might not reappear in court.

"If I had known this individual had been eluding police for 17 months," Hess said, "I can assure you that it is very unlikely that he would have been released.

In several other instances this week, Hess sharply questioned prosecutors when the judge apparently felt they had not adequately determined whether evidence existed that a defendant might be a danger to the community or possibly would flee if he were released.

At one point yesterday, Hess told one prosecutor that he wanted to talk to this supervisor about the lack of imformation the judge felt he was being provided by prosecutors. Hess and Terry H. Russell, deputy director of the U.S. attorney's Superior Court office, later consulted about the issue.

Neither Hess nor Russell would comment on their discussion.

The reason that Ferguson, who was charged with armed robbery, was not considered a danger to the community was that he had no prior record of serious offenses, the Pretrial Services Agency said. According to court records, Ferguson was convicted of a simple assault charge, for which he served 90 days in prison in 1975, and of a minor drug charge, for which he paid a fine.

Because there was no basis to hold him as a danger to the community, the only other question was whether he might flee. Since that issue was never raised by prosecutors in court, Hess said he never considered it when he decided to release Ferguson.

Ferguson's attorney, Judith Mruczka of the Public Defender's Service, would not comment on the case other than to say that she did not object to her client's release into the custody of Stepping Stones, which specialize in cases involving alcoholics. Ferguson's next scheduled court date is Aug. 26. c

Bruce D. Beaudin, director of the Pretrial Service Agency, said it had never learned that Ferguson had actively avoided law enforcement authorities.

Therefore, he said, the agency concluded that its only determination lay in whether Ferguson should be released on personal recognizance or into the custody of Stepping Stones because of Ferguson's alleged drinking problem.