Mayor Marion Barry said yesterday an estimated 40,000 people are living illegally in District public housing units and that they will be asked to leave beginning this month because they cost the city money in utility consumption and repairs on overcrowded housing units.

Barry's announcement came at a news conference in which he released a report on the condition of the city's 11,769 public housing units.

City officials previously had maintained that the public housing population was 60,000, but the report said "there are in reality, well over 100,000 residents crowded into public housing units, including relatives and friends who have nowhere else to live in our city."

A housing department spokesman said that public housing tenants will receive letters this week indicating that anyone whose name is not on the lease must vacate the units.

Housing spokesman Oliver W. Cromwell said the eviction plan is based on the fact that illegal residents cost the city money in unpaid rent, utility costs (in most cases included in rent charges), and wear and tear on housing units.

By federal law, public housing rents are limited to 30 percent of a family's monthly adjusted income. Although the District would be entitled to receive rent payments from the families who have a monthly income and reside in public housing illegally, the city receives no rent from them because it has no record of them.

Most of the several hundred people, including public housing tenant council representatives, who gathered for the news conference under a red and white tent at the Benning Terrace public housing complex in Southeast Washington, seemed pleased with the announcement.

Barry, who said the number of illegal tenants could range from 5,000 to 40,000, said his administration had not made any plans to help relocate the thousands who would be evicted from public housing.

"I sympathize with people who need housing but the District cannot do it all," said Barry, noting that few large cities can meet the housing needs of their poor.

City Council member Charlene Drew Jarvis (D-Ward 4), head of the council's housing committee, and housing advocacy groups said they were shocked by Barry's plans.

"I am shocked that that plan of action has gone without any review by the council," said Jarvis. "It will clearly create pressure on the very government that is taking the action. It will create an enormous need for social services."

Housing advocates said there is already a shortage of affordable rental housing for low-income District residents and that Barry's plan will make the situation worse.

"The city is not prepared to absorb 40,000 people into the homeless community," said Larry Weston, head of the Metropolitan Washington Planning and Housing Association. "In the absence of having available, affordable units, it is no real answer at all. A much better response would be to discuss how you're going to produce new housing units."

The planned eviction of illegal residents seemed to contradict the position the administration takes in sections of the 73-page public housing report released yesterday. For example, the report says it would be too "simplistic" to evict all legal public housing tenants for not paying rent because "tenants usually have nowhere else to go; to evict them would just add to our homelessness problem and cost the government more per day than to keep them in public housing."

Barry's report, which included a lengthy history of public housing in the District and problems created by shortages of funds and trained staff, was a response to press reports and U.S. Department of Housing and Urban Development concerns about maintenance problems and deteriorating conditions at the city's 56 public housing properties.

Barry said that although the city inherited many of the problems from the federal government, which managed public housing prior to 1975, it has approved $137 million to make public housing "solid, safe and decent" and has proposed spending an additional $38.6 million.

"I don't have some of the answers to some of these problems," Barry told a reporter. "But we're trying and I don't think people appreciate the level of difficulty to get this damn job done."

Barry said the District has one of the nation's most extensive public housing modernization projects, which include 5,281 units or 45 percent of all the city's units. He said 1,587 units have been renovated and an additional 684 are under construction. He also stressed that the city's high vacancy rate, 16.2 percent, is largely due to the many units scheduled for major renovation.

Barry's plans to address public housing problems include:

*Conducting a $1 million engineering survey that will determine the repairs needed at each property and become the basis for a preventive maintenance program.

*Establishing an "organizational analysis" group made up of city officials and private sector representatives to determine whether the public housing operation should be removed from the Department of Housing and Community Development and placed under a separate public housing authority.

*Using a newly formed Office of Community Involvement, which has a 15-member staff, to promote "improved tenant relations."

"I'm very pleased," said William H. Taft, representative for the Ellen Wilson public housing resident council. "At least the people can see that he Barry is moving toward addressing the problems that have existed for some time."