A federal judge has ruled for the first time that the independent-counsel law underpinning an unprecedented number of investigations of Reagan administration figures is constitutional.

U.S. District Court Judge Aubrey E. Robinson Jr. said the legislation was an appropriate and measured response by Congress "to the recurrent question of how to enforce the laws of the United States when they are violated by high government officials . . . .

"For the United States," Robinson added, "the act represents a landmark effort to instill public confidence in the fair and ethical behavior of public officials."

The ruling came as a surprise in light of the U.S. Court of Appeals' instructions to Robinson in June, in a case involving fired National Security Council aide Oliver L. North, to try to settle the matter on other than constitutional grounds. Robinson did just that on July 11, skirting North's constitutional challenge to independent counsel Lawrence E. Walsh's investigation and holding instead that Walsh's backup appointment in March as a Justice Department prosecutor was valid.

The judge's latest ruling, by contrast, met the constitutional issues head-on. It was issued Monday, evidently in response to challenges to the law arising from three grand jury subpoenas issued earlier this year -- not by Walsh, but by other independent counsels.

As chief judge of the U.S. District Court here, Robinson is in charge of all federal grand juries here. He did not specify the cases that prompted the ruling, on the grounds that the matters were under seal.

Charges that the law is unconstitutional have been addressed primarily to provisions creating a special three-judge federal court to appoint independent counsels and to define the scope of their investigations. Defense lawyers for North and other individuals have contended that the independent counsels are "superior officers" who, under the Constitution, must be appointed by the president and confirmed by the Senate.

Robinson rejected the argument. The Constitution, he wrote, "expressly grants to Congress the authority to 'vest the appointment of such inferior officers as they think proper, in the president alone, in the courts of law, or in the heads of departments.' "

Citing earlier cases on that point, Robinson said, "The independent counsel is clearly an 'inferior officer' -- he is appointed for a single task to serve for a temporary limited period." The judge said Congress evidently thought that when it set up the system and the attorney general did, too, in assuming the authority last March to make the backup appointment of Walsh.

Sen. Carl Levin (D-Mich.), chairman of the Senate governmental affairs subcommittee with jurisdiction over the law, praised the ruling as "welcome guidance to the Congress" as it considers reauthorization of the statute. The law will expire next January unless Congress renews it.

"This is the first time a federal district court has ruled squarely on the constitutionality of the independent counsel statute," Levin said in a statement. Robinson's decision, Levin said, "upholds the law's basic mechanisms."

Marine Lt. Col. North already has served notice that he is appealing Robinson's July 11 ruling affirming Walsh's backup appointment by Attorney General Edwin Meese III. Yesterday's decision is likely to be appealed, too. Those directly affected by it were not named, but they may have been subjects of investigations by independent counsels who did not accept backup appointments, thus forcing Robinson to confront the constitutional questions.

Robinson said he saw nothing wrong with allowing "an impartial court of law to select, at the application of the attorney general, an individual to investigate and potentially prosecute criminal activity within the executive branch." The appointing court, he noted, "plays no role in {independent counsel} investigations and peforms no acts with regard to any prosecutions that may result."

Independent counsels can be removed by the attorney general only "for good cause." Robinson said "inferior officers" in situations such as this require "a certain degree of independence from the president" and "the Congress may insulate him or her from the threat of termination at will by the executive."