Three black D.C. firefighters, each with more than 10 years' experience on the force, testified yesterday at a public hearing that they felt they had suffered racial discrimination throughout their careers in the city fire department.

The instances the firefighters described ranged from a now-defunct policy, in effect in the early 1960s, of prohibiting black officers from sleeping in station-house beds used by white officers, to more contemporary allegations of having been passed over for assignments or promotions because they are black.

The extraordinary hearing, which is being held to determine whether stringent affirmative action measures are needed in the department, began before city hearing examiner Patrick Kelley after a last-minute settlement plan proposed by the city collapsed.

The hearing was scheduled after Mayor Marion Barry's administration challenged a decision by Anita B. Shelton, the city's human rights director, ordering the city to fill 60 of the next 70 vacancies in the department with blacks and to institute a permanent affirmative action plan for hiring and promotions.

In the proceedings, which Barry aides have tried diligently to prevent, the city finds itself allied with the predominantly white bargaining agent for the department's rank-and-file employes, Local 36 of the International Association of Fire Fighters. The city and the union are defending the department's record in hiring and promoting blacks. While the city is now more than 70 percent black, the fire department is about 32 percent black.

Opposing them are two black firefighters' groups -- the Progressive Firefighters Association and the Black Fire Officers Association -- who initiated the action that led to the hearing. The situation is fraught with potential political embarrassment for the mayor, who faces an election next year and would hardly relish offending either blacks who favor affirmative action or Local 36, which supported him for mayor in 1978.

"There is no desire on anyone's part for a wholesale bloodletting," a Barry aide who asked not to be named said yesterday. The aide explained that a proposed settlement, which would have avoided the need for a hearing, had been placed on the table.

But Joan Burt, the attorney for both black firefighters' groups, disapproved of the settlement, which would have provided that the city hire 19 black firefighters immediately and take other steps to eliminate possible discrimination, like the development of nondiscriminatory entrance and promotional exams. Burt said she could not accept language in the proposed settlement which would have precluded future discrimination against whites in order to correct the racial balance of the department.

Sgt. Theodore O. Holmes, president of the Progressive Firefighters, testified that shortly after he joined the department nearly 19 years ago he was told at his station house to sleep in a bed marked "C," for colored. He said he protested, but finally realized that he had to do so to remain in the department.

He said he was denied leave to attend school, while white firefighters were granted leave for that purpose. He also said he was denied a job as head of the department's community relations unit on the grounds that he was unqualified, although he had previously served as the chief deputy in the unit and had at times acted as head of the unit with no criticism from supervisors.

Sgt. Jon Sheffield of the Black Fire Officers testified that when his group tried to put up posters in the firehouses urging minorities to sign up for a recent examination to become firefighters, a supervisor ordered that they be taken down. He testified that the department in the past has not made enough efforts to recruit in predominantly black Washington, instead recruiting in the mostly white suburbs and even as far away as Pennsylvania and New York.

Lt. Ray Alfred, whose testimony took most of the day, said that he had appealed to Local 36 for help in eradicating what he saw as a pattern of denying promotions and the best assignments to blacks. But he said he received no response from the union, and so in 1968 became one of the founders of the Progressive Firefighters.

He said that there was an "unwritten law" that there could be no more than one black officer per company per shift. He said that when blacks became senior in their units, and thus in line for promotions, they were routinely transferred to other divisions where they would not be the senior most firefighters. Alfred said he believed five white officers deliberately delayed their retirement in 1978 so that he would not be in line to be promoted to sergeant.