D.C. Mayor Marion Barry ordered the city yesterday to clear up within 10 days all fire and health violations at a majority of the 27 homes operated by the city government for homeless, mentally retarded or incarcerated adults and children.

The mayor also took the unusual action of reprimanding Albert P. Russo, director of the city's Department of Human Resources, for failing to enforce a 1977 law regulating half-way houses and nursing homes.

The mayor ordered all violations corrected after receiving a 19 - page report that said six of the homes lacked fire escapes, seven lacked smoke detectors and 10 lacked adequate fire extinguishers, fire doors or alarm and exit light systems. In addition, 16 of the homes are infested with roaches and mice, the report said.

All of the homes except one contained some violations, such as exposed wiring, loose handrails and inadequate storage of drugs.

"They weren't as bad as I thought they'd be," Barry said after a press conference at which he released the inspection report. The mayor visited two of the homes last week and found minor violations at both.

The repairs will cost less than $35,000, and none of the more than 600 residents will be forced to move, Barry said yesterday.

Barry ordered the inspections April 13, two days after nine elderly women were killed in a fire that gutted a privately owned Northwest home for outpatients of St. Elizabeths Hospital. The Hospital is a federally owned institution for the mentally ill.

During congressional hearings Wednesday on that fire and others around the country, Rep. Claude Pepper (D - Fla.) called for a grand jury investigation of the city's system for licensing homes for the elderly, denounced the city's fire department and later, outside the hearings, called city Fire Chief Jefferson W. Lewis "a dumbbel."

Reacting to Pepper's charges, Barry said yesterday, "I think the fire department is one of the finest in the country. I don't know what Congressman Pepper is talking about." Barry said he did not think that Pepper, who is chairman of the House Select Committee on Aging, understood the city's licensing system. Barry also announced measures designed to give increased power to all city inspectors and to train them better to recognize violations of any city regulation. Inspectors are now scattered among the city's fire, housing, human resources and environmental services departments. In addition, the city's inspectors now inspect only for violations supervised by their departments.

In giving increased power to all inspectors, Barry said he hopes to correct the "archaic, splintered and illogical" system for licensing buildings and businesses that he said his administration inherited when he took office in January.

As an example of the problems he is trying to correct, Barry said that only building inspectors can order the owner of a building to install a fire escape under current regulations. After next week, Barry said a fire official can require such installations.

Barry said he will accomplish the changes through training of inspectors to recognize code violations of any nature. No changes in the law are required.

When the 27 city - operated homes were inspected for the report issued yesterday, inspectors from different agencies checked different code requirements, according to Ralph Spencer, who supervised the inspections. He said building inspectors checked fire extinguishers, fire doors, fire alarm systems. Fire officials inspected only for smoke detectors.

In addition to reprimanding Russo for not enforcing the 1977 regulations, Barry said the DHR director also "knowingly" placed DHR clients in unlicensed facilities.

"I march to the beat of the mayor's drum," Russo responded when asked about the reprimand. "It is a moment that requires great restraint."

Russo took over as chief of thecity's largest and most criticized department two years ago after former director Joseph P. Yeldell was charged with bribery and conspiracy. Yeldell was convicted of the charges but that conviction was set aside by a federal judge and a second trial has been ordered.

Russo said the mayor "is absolutely right . . . I assume full responsibility for everything that happened." Russo declined to say why his department had never inspected and licensed the 300 halfway houses and private nursing homes in the city. These homes mostly care for elderly people.

Barry said that city inspectors have begun visiting 53 privately managed homes that have contracts with the city to take in people. Inspections of the 300 halfway houses and private nursing homes will begin next month, Barry said.

Barry also said he has told the city's department of licenses, inspections and investigations to clean up a back - log of 6,000 applications for certificates of occupancy. A certificate is needed to operate any business in the city. It cannot be issued until the building concerned has been inspected by the city.

In another matter, Barry said that James Ferguson, the Lamont Street house before the fatal fire, has been suspended for 90 days without pay, demoted and transferred out of the inspection division of the housing department