A federal judge, reinforcing the independent powers given to the District of Columbia with home rule, told President Reagan yesterday that he had exceeded his authority when he attempted to replace a member of the city's judicial nomination commission with his own appointee.

U.S. District Judge John Garrett Penn ruled that when Congress approved legislation creating the D.C. Judicial Nomination Commission, it intended that its members serve "without fear of removal" and that they remain isolated from political considerations that could interfere with the selection of nominees for judgeships solely on the basis of merit.

Penn said that when Congress established the commission, it specifically meant it to be an independent body, free from the influence of the president or anybody else. Penn rejected the government's argument that the president nevertheless had the authority under the Constitution to remove a presidential appointee to the commisssion at any time for any reason.

While the president may have authority to remove appointees who are "meant to do the president's bidding," that does not apply to commission members whose sole job is to make independent decisions based strictly on merit, and whose duties are confined to the District of Columbia, Penn wrote.

The court ruling effectively reinstate Washington attorney William A. Borders Jr. to the seven-member commission, which nominates candidates for seats on the D.C. Superior Court and D.C. Court of Appeals. The commission also selects the chief judges of both courts. Borders had been appointed by former president Carter in July 1980 to a five-year term on the commission. Last May, Reagan told Borders that his membership was terminated, thanked him for his "dedicted service" and appointed attorney Philip A. Lacovara to take his place.

Borders then filed a lawsuit that led to yesterday's ruling by Judge Penn. Borders challenged Reagan's authority to remove him from the commission, prompting a ticklish political battle with the Reagan administration, which wanted its own appointee involved in the influential process of selecting new local judges.

"I never thought I served at the pleasure of the president," Borders said in a telephone interview yesterday. He described himself as "elated" with Penn's ruling and said he fully intends to serve out his term on the commission. Government attorneys said late yesterday they are considering asking the U.S. Court of Appeals to reverse Penn's ruling. The White House had no comment on the case.

Meanwhile, Mayor Marion Barry said that Penn's ruling was "another important step in the independence of our local judiciary.

"It's time to move the course of home rule forward in the District of Columbia to its completion," Barry said, referring to now dormant proposals to transfer all authority over local criminal and civil cases from the federal to the city government. That controversial plan had been supported by the Carter administration as an additional step toward full home rule in the District.

The nonination commission was established in 1974 under the city's home rule act. Prior to that, local judicial appointments were made directly by the president. Now the president names one member to the seven-member nomination commission, which in turn submits three names to the president for each vacancy that occurs on the local bench.The president must select one of the three names for the vacancy. Of the remaining members of the nomination commission, two are appointed by the D.C. bar, two by the major, one by the D.C. City Council and one by the chief judge of the federal court.

Penn, in a 36-page opinion in the Borders case, said that the appointment scheme did not mean that each group was to have "it's 'own man' [or woman]" on the commission, or that the appointees should have the same political or philosophical view as the group that put them on the commission. Rather, Penn said, Congress hoped that the commission would reflect the views of each group -- as an institution -- on the "merit qualifications" of candidates for judgeships.

The president's appointee, Penn said, was supposed to represent the "federal" viewpoint, not the views of a particular president or his administration.

The language of the act also makes it clear that Congress intended that a commission member serve a complete term and makes no provision for removal of a member at the will of the president, Penn said.

The primary importance that Congress placed on the independence of the commission members limits the power of the president to remove his appointee, the judge said.