A federal judge has ruled in favor of eight white D.C. firefighters who accused the city government of discriminating against them when they were passed over for promotions.

U.S. District Judge Joyce Hens Green awarded the firefighters, all of whom are retired, back pay and retroactive pension benefits that the plaintiffs' lawyer estimated to be worth about $160,000, plus higher pensions in the future.

Although the ruling comes in the midst of a legal battle over the fire department's current affirmative action plan, the decision dealt only with District government policy five years ago, shortly after Mayor Marion Barry took office.

In a 39-page ruling, Green found that the eight firefighters, all of whom were battalion commanders, were "subjected to race-based discrimination" in the selection process for deputy fire chief in January 1980.

The ruling strongly criticizes former city administrator Elijah B. Rogers, who was found liable in the case, for making "race-based promotions." But the judge dismissed a claim against Barry, saying there was "no evidence" that he had "participated in the discriminatory selection process, even though he later ratified its results."

Green's ruling, signed Tuesday, is based on a four-day nonjury trial last October.

Edward F. Dougherty, the retired firefighter who took the lead in organizing the suit, praised the ruling as "vindication" after five years of litigation, which also included a decision in the firefighters' favor by the federal Equal Employment Opportunity Commission in 1982.

However, his lawyer, Robert W. King, said it may take several years before the men receive any money if the District appeals.

D.C. Corporation Counsel Inez Smith Reid could not be reached for comment yesterday.

The other plaintiffs were: Andrew T. Buckler Jr., Wilton E. Watts, Henry J. Ford, Francis X. Flaherty, Bernard M. Bowerman, Vincent K. Elmore and William H. Phillips.

Green said all had more experience and greater "objective credentials" than two blacks Rogers appointed to the deputy fire chief post in January 1980 -- Theodore Coleman, now the D.C. fire chief, and Joseph Kitt. In the 1980 round of appointments Rogers also named a third deputy fire chief, Alfonso Torre, who is white, and who Green said had been passed over in favor of another black the year before.

In her ruling, Green referred to testimony by former assistant fire chief John Devine, who is white. Devine testified that Rogers told him in December 1979 that he would be named fire chief on condition that four of his top subordinates be black. Devine said he disagreed because "he saw no place in the department for promotions based strictly on race" and withdrew from consideration for the appointment.

Later, in May 1980, Green said that all the plaintiffs along with several other witnesses said Mayor Barry told them at a meeting with the department's top brass that he had "a commitment to achieve racial balance" and "a 'mandate' to promote blacks at all levels of the department in light of past racial discrimination." Barry added, according to the testimony, that the officers should "get on the team" or retire.

When Dougherty shook his head and said he disagreed with the policy, Barry left the meeting, Green said the testimony showed.

Rogers then "angrily told the officers, 'If I could, I'd fire half of you,' " Green said.

Within the next four months all eight plaintiffs retired, Green continued, because they saw no opportunity for advancement.

At the trial the city government contended that the preference for blacks was permissible as part of affirmative action, but Green ruled that the city's antibias plan then provided for "equal employment opportunity . . . not guarantees of racial balance."