When a confident Mayor Marion Barry hosted a champagne reception this week to celebrate the District's legislative victories on Capitol Hill, the two guests who drew the most attention were White House counselor Edwin Meese III and U.S. Attorney Joseph diGenova.

Meese's presence added credence to Barry's assertion that as mayor he has grown in stature as a negotiator at the White House and on Capitol Hill. But diGenova's surprise appearance provided a reminder of the uncertainties dogging Barry's political future.

For much of this year, Barry looked like a politician fighting for his political life and presiding over a highly nervous bureaucracy.

He had been personally linked to Karen Johnson, a former city employe convicted of selling cocaine. DiGenova's office was pursuing a grand jury investigation of drug use by other city employes and of allegations of wrongdoing within two major city agencies. And the White House and some Republican senators were threatening to strip the District of significant powers in revising the home rule charter.

But today, the mayor exudes confidence. He now talks about this year being a banner year not only for the D.C. government but for the Barry administration.

Barry demonstrated his talents as a negotiator by enlisting Meese's support to break a year-long deadlock over revisions to the home rule charter that delayed District plans to issue $1 billion in bonds and notes. He helped orchestrate a regional waste-water disposal agreement to get rid of the District's 183,000-ton pile of sludge.

And Barry and his key allies managed to put the U.S. attorney on the defensive, at least temporarily, by complaining to the Justice Department that diGenova's office leaked information about the drug investigation to the press in an effort to embarrass the mayor.

Administration officials and some members of the D.C. City Council believe that Barry has managed to shift public pressure from himself to diGenova. In the words of one of the mayor's aides, diGenova should "put up or shut up."

DiGenova, who repeatedly has declined to publicly discuss the grand jury investigations, left town late this week for a vacation and could not be reached for comment.

Sources say the investigations are continuing and that witnesses are being questioned. However, the investigations have proved to be extremely complicated and time consuming, the sources said.

In two of the cases, involving the District's financially troubled Bates Street housing project and the questionable contracting and purchasing practices of the D.C. Department of Employment Services, investigators are examining volumninous records and financial data, as well as interviewing witnesses.

In August, Barry publicly accused diGenova's office of attempting to "lynch" him, figuratively speaking, by leaking damaging but uncorroborated evidence about the mayor in the Karen Johnson drug investigation. Later that month, Barry and his aides accused diGenova and other Reagan administration law enforcement officials of using "a leak a week" to embarrass the mayor.

They were reacting to a story in the New York Times that said federal investigators were examining whether Barry committed perjury when, according to sources, he testified before a grand jury in January that he is not a cocaine user and had not obtained cocaine from Johnson.

City Council Chairman David A. Clarke subsequently asked Attorney General William French Smith to seek appointment of an independent prosecutor to find and punish any federal officials who leaked information about the grand jury investigation. Smith has yet to respond.

Sensing that the momentum was with him, Barry launched an extraordinary public relations campaign to court reporters and to demonstrate he is very much in control of the city government.

He began this month by publicly declaring victory in the city's perennial war on potholes. Last week he held a bizarre luncheon celebration on the site of the former sludge pile, at the Blue Plains waste-water treatment plant in Southwest Washington, to mark the signing of the regional disposal pact.

Barry held a press conference on Tuesday to announce the District had received the highest possible credit rating from Moody's and Standard & Poor's for short-term borrowing -- clearly a feather in the cap of a city that once struggled to balance its operating budget and to pay its electric bill.

That evening, he held the champagne reception in the Mayor's Conference Room to celebrate passage of the revised home rule legislation and another measure that transfers responsibility for St. Elizabeths mental hospital from the federal government to the District.

"This has been a banner year for the District of Columbia government and for the Barry administration," the mayor boasted to reporters that day. " . . . It was not done by accident or by happenstance or by luck. It took a lot of hard work."

On Wednesday Barry invited the local press along on a Potomac River cruise, complete with a wine and cheese buffet and a jazz duo, as he and other officials unveiled plans for development of the Georgetown waterfront and construction of a Metro subway stop in Anacostia.

Then Barry, the self-described "Mobile Mayor," dashed across town to take part in a press conference with Police Chief Maurice Turner and D.C. Board of Education officials to outline plans to tighten security at city schools and to make teachers and students more aware of child and sexual abuse and how to prevent it.

Barry's courtship of the press has been relentless. He continues to hold monthly off-the-record breakfasts with reporters who agree to the ground rules (The Washington Post does not take part) and he seeks out reporters in other informal settings to get his message across.

His department heads and top aides, who once scrupulously avoided talking to reporters, now are under orders from the mayor to meet with reporters on a regular basis.

A memorandum prepared by the mayor's press office and distributed to department heads instructs officials on which reporters to contact and what topics to discuss.

"It's not a master plan," Annette Samuels, the mayor's press secretary, told a reporter. "It's something the mayor has felt strongly about . . . . so that you all can get to know agency and department heads and they get to know you."

As for the grand jury investigations still hanging over him, the mayor doesn't have much to say publicly about them these days, other than to quip: "You don't see anymore leaks a week, do you?"

However, in an off-the-record meeting with reporters this week, Barry did volunteer an interesting bit of news. While he continues to make periodic inspections of the Lorton Reformatory, he has discontinued his visits to the D.C. Jail.

Why? Because Karen Johnson is serving an 18-month contempt of court sentence there for refusing to testify before the grand jury in the drug investigation, and Barry doesn't want anyone to think he is trying to influence her in any way.