A D.C. Superior Court Judge yesterday ordered a hearing in his courtroom closed after he learned that the press was inquiring about a preventive detention hearing for a 17-year-old charged as an adult in a rape case.

It was the first closed hearing ordered by a judge in the Washington area since the Supreme Court last July approved the closing of criminal court hearings in certain circumstances, according to court officials.

Judge Shellie Bowers ordered the doors of Courtroom 26 locked and directed attorneys in the case not to discuss the matter with reporters. The closed hearing was requested by two public-defender service attorneys and was granted despite the strenuous objections of the prosecutors in the U.S. Attorney's office here, sources said yesterday.

Judge Bowers said he would have no comment about the proceeding. It stemmed from an attempt by the defendant's attorneys to obtain his release before trial.

Last July, the Supreme Court rejected the appeal of the Gannett newspaper chain and upheld a judge in a New York state case who had closed a pretrial hearing. Many lawyers have professed confusion about the scope of that ruling.

All of the justices who signed the majority opinion agreed that the public has no independent right to attend a pretrial hearing when defendant, prosecutor and trial judge all agree to close the hearing to preclude possibly prejudicial publicity.

However, in the opinion that he wrote for the court's 5-to-4 majority and that appeared to broaden the scope of the ruling, Justice Potter Stewart asserted that the public has no constitutional right to attend criminal trials.

Since then, attorneys or judges have tried to close 185 court proceedings, as of Feb. 15, according to the Reporters Committee for Freedom of the Press. More than 120 of those involved pretrial hearings.

Of the 185 attempts to close courtrooms, 93 are in force or have been upheld on appeal.

Those cases include an attempt by an Anne Arundel County Circuit judge to bar an Annapolis Evening Capital reporter from a pretrial hearing in an arson case.

Meanwhile, the Supreme Court has before it a 1978 case in which a Virginia judge closed an entire murder trial in Hanover County. That case has been brought by Richmond Newspapers Inc.

In that case, Virginia Attorney General J. Marshall Coleman argued that the press and public have no constitutional right to attend a criminal trial, if the defendant, judge and prosecutor agree to close the proceeding.

The court's action in the case is being watched closely because it is being viewed as a chance for the court to clarify its ruling in the Gannett case.

More than 56 newspapers, including The Washington Post, the three major television networks and the American Civil Liberties Union have filed briefs supporting the Richmond papers' attempts to get the trial open.