The District of Columbia government agreed yesterday to promote five white firefighters who had accused the fire department of discrimination.

The action was announced as part of a settlement reached just before a trial on the firemen's antidiscrimination lawsuit was scheduled to begin before U.S. District Judge Charles R. Richey.

In April, Richey invalidated the portion of the fire department's affirmative action plan that covers promotions, ruling that its racial quotas "deprive innocent whites of their legitimate expectation of advancement."

However, Richey's ruling, now on appeal, approved the hiring portion of the plan, which set aside about two-thirds of the jobs for blacks.

Under yesterday's settlement order, Sgt. Terry Hummel will be promoted to lieutenant within 14 days and Lt. William G. Andrews will be promoted to captain at the same time.

The promotions will be retroactive, with full back back pay to August 1984, when both men were passed over in favor of blacks who scored lower on departmental exams.

Three other whites, who also were passed over by lower-scoring blacks, will be promoted on an acting basis within two weeks, under the settlement. The city promised that they will be given permanent promotions before any other candidates unless Fire Chief Theodore Coleman has "good cause" for finding them unqualified.

According to the settlement, Lts. Larry A. Watts and Richard R. Whitsel will be promoted to captains and Sgt. Everett Cooper will be promoted to lieutenant.

The city also agreed to pay the men's legal expenses. As part of the settlement, both sides promised not to make statements to the news media about the case.

The firemen's lawsuit, filed in July, is part of lengthy legal wrangle between the District and its white firefighters over the city's policy of increasing the number of blacks in the D.C. Fire Department.

According to figures filed in court, blacks made up 38 percent of the fire department's uniformed work force last year, but since 1982 have accounted for more than two-thirds of those hired and promoted.

The affirmative action plan, which the District contends is necessary to overcome past discrimination, specifies that the racial composition of the department should reflect the proportion of blacks in the working-age population of the city, which would be about 65 percent.

However, according to papers filed in the lawsuit, the U.S. Equal Employment Opportunity Commission found "reasonable cause" last summer that the five white firemen had been discriminated against, in violation of the 1964 Civil Rights Act.