The U.S. Court of Appeals ruled yesterday that a white former chief appeals officer of the federal Merit Systems Protection Board was discriminated against when he was dismissed from his post three years ago and replaced by a black attorney.

The three-judge appellate panel, in overturning a lower court ruling that the agency's acton was justified, said in an opinion that Thomas J. Lanphear should have been retained in his post at the agency's Washington field office.

The appeals court, dismissing the agency's contention that Lanphear had been replaced because of poor job performance, said Lanphear "constantly received the highest ratings for his work" and "was passed over in favor of a black male from outside the agency whose qualifications were not fully reviewed by the selecting official."

The court ruled that U.S. District Court Judge John Garrett Penn erred when he dismissed Lanphear's suit on grounds that agency officials had legitimately replaced Lanphear because they "wanted new faces" in the agency's top positions.

An attorney for Lanphear, Joseph B. Scott, yesterday hailed the court's ruling, calling the agency's decision to dismiss Lanphear "an example of the excesses of affirmative action."

Lanphear, who now works in the agency's headquarters, is seeking back pay and reinstatement to his old job--issues that must now be decided by the District Court. He was vacationing and could not be reached for comment. A spokesman for the Merit Systems Protection Board, the government's agency for hearing personnel complaints of federal and some District employes, declined to comment.

Lanphear, whose level is GS-15, had worked for eight years with the Civil Service Commission when he was appointed chief appeals officer in the Washington office in 1978. In 1979, that agency was absorbed by the new merit board and its chairman issued an affirmative action plan that included the appeals post.

Lanphear's replacement was a Justice Department attorney who has entered private practice in the city.