A federal appeals court panel ruled yesterday that the District discriminated against five white fire department officials when it bypassed them and promoted a black to the department's second-ranking position in 1974.

The decision by the three-judge panel, which reversed a February 1985 ruling by U.S. District Judge Joyce Hens Green, deals only with the promotion of Jefferson Lewis to assistant fire chief for operations and is not related to another case now before the appeals court in which the federal government is challenging the fire department's affirmative action hiring plan.

"This was racial discrimination, pure and simple," said Douglas B. Huron, the firefighters' lawyer. "A lot of us support affirmative action plans and there wasn't one involved."

The appeals court panel sent the case back to Green and ordered her to reconsider claims by the five white firefighters, all of whom retired within four years of Lewis' promotion, that they were forced from the department. Green also must determine how to compensate the five.

Huron said he expected the five would ultimately receive compensation similar to that recently given another white firefighter, Ed F. Dougherty, who successfully sued the city on grounds that he was discriminated against when he was passed over for promotion in 1983. Dougherty was awarded $41,000 in back pay and pension benefits and received a retroactive promotion.

Because of the length of time since Lewis' promotion, observers estimated that the appeals court decision could cost the city hundreds of thousands of dollars.

A spokesman for the fire department said officials had not seen the opinion and had no comment.

Lewis was named fire chief in 1978, but his administration was marked by uneasy relations with both rank-and-file firefighters and fire officials and he left after serving 20 months.

Former fire chief Burton Johnson testified before the district court that race did not play a role in his selection of Lewis, who was a battalion chief at the time. Judge Green accepted his account.

But the appeals panel said the five white firefighters "presented a strong affirmative case of discrimination which included both circumstantial and direct evidence," wrote Judge Laurence Silberman. "The District Court's finding of no discrimination is clearly erroneous," said Silberman. He was joined by Judge Antonin Scalia, and Judge Patricia Wald concurred with the decision in a separate opinion.

The appeals court decision supports a 1982 determination by the U.S. Equal Employment Opportunity Commission that Lewis' promotion was discriminatory.

The lawsuit was filed in 1983 by former deputy fire chiefs Sidney Bishopp, John Breen, William Q. Stickley, Floyd E. Yocum and Joseph E. Zeis after they were unable to reach a settlement with the city on the EEOC ruling.

Thomas Tippet, president of Local 36, International Association of Fire Fighters, said the case was the fourth in which it was determined that the city had discriminated against white firefighters. "It shows to me a pattern of the city doing things and then having the courts undo them."

Romeo Spaulding, president of the all-black Progressive Firefighters Association, said he had no comment.

Yocum, who now lives in Myrtle Beach, S.C., said yesterday that the court's decision, coming a week before his 65th birthday, "is just a little late to be as satisfying as it could have been . . . . When we started this, my hopes were that I'd still be young enough to go back to the job." The fire department's compulsory retirement age is 64.

Yocum said that the five also hope to recover their legal expenses, which have been about $45,000.