Mayor Marion Barry renewed his criticism of the news media yesterday for publishing what he said were unlawful leaks from the U.S. attorney's office, while he declined to comment on recent reports of alleged wrongdoing by District officials.

"It carries us back to the McCarthy era where you're guilty by association and you're guilty by media innuendoes," Barry said during his monthly press conference. "I think a dangerous trend is being set here where people are now being tried by the media as opposed to being tried by their peers."

During his nearly hour-long meeting with reporters, the mayor also contended that at present there is not a serious problem of overcrowding at Lorton Reformatory and the D.C. Jail, a contention strongly disputed by D.C. correctional officers.

However, Barry said he was "open" to a suggestion by Sen. Arlen Specter (R-Pa.) and U.S. Attorney Joseph E. diGenova that the federal government pay for construction of a new prison facility on federal land within the District.

"I have not endorsed any idea of putting another prison in the District of Columbia, but any thinking and rational person . . . would not be opposed to looking at options," he said.

Yesterday's session was the mayor's first formal meeting with the press since returning from his trip to Africa last month. Much of the press conference was devoted to the nagging problems within the D.C. Department of Corrections and the latest in a series of revelations of alleged wrongdoing by present and former city officials.

Barry said he was heartened by a recent Washington Post poll showing that 65 percent of D.C. residents felt he was doing a good or excellent job as mayor, while only 51 percent approved of what he is doing to ensure that top D.C. government officials maintain a high ethical standard.

"I learned that 51 percent is a majority," he said. "I can't please everyone in this city."

In response to questions, the mayor refused to say whether he thought Thomas M. Zuniga, the executive director of the D.C. Housing Finance Agency who is under investigation by the FBI, should resign. Nor would he say anything about former deputy mayor Ivanhoe Donaldson, who is the target of a federal grand jury investigation.

Zuniga is being investigated to determine whether he charged personal expenses to the Housing Finance Agency (HFA). A federal grand jury is investigating whether Donaldson misused city funds while he served as director of the D.C. Department of Employment Services. Barry said that it was up to the semi-independent HFA board and not the mayor to determine whether to take administrative action against Zuniga.

As for Donaldson, Barry said it would be inappropriate for him to discuss the investigation or to say whether he continues to have full confidence in the integrity of his longtime friend and political adviser.

"The constitution and the criminal justice system doesn't allow me to interject myself," he said. "Here is an investigation going on . . . . There already has been some illegal activity on the part of the prosecutors by giving you some information that is illegal . . . . There is no place for my comment in the criminal justice system at this time."

DiGenova's office declined to respond yesterday to the remarks.

On other subjects, the mayor:

* Announced that the federal government had given the District $2.3 million "up front" to defray costs associated with President Reagan's inauguration next week.

* Said he fully supports the concept of rent control, but declined to take a position on whether the current law, due to expire this year, should be extended or modified.