Mayor Marion Barry went to Capitol Hill yesterday to defend his $1.9 billion 1983 budget, and members of Congress -- who in years past grilled him on everything from the size of the D.C. police force to the accuracy of the city's books -- gave him the warmest reception in his tenure as mayor.

One member of the House District Appropriations subcommittee, noting that he had always had "at least one ax to grind with the city," did question Barry on several points. But after hearing the mayor's answers, Rep. John Porter (R-Ill.) asserted: "That's four home runs on four pitches. I think I'll quit before I get further behind."

After yesterday's opening session of 10 days of department-by-department hearings on the District of Columbia budget, subcommittee chairman Julian C. Dixon (D-Cal.) said members would go on to look more closely at such areas as increases in the city's education budget, funding for welfare and social programs and the D.C. lottery.

Dixon attributed the warmth of the opening round, in part, to the solution of an issue "that has been at the forefront in the past -- the hiring of more District police." Two years ago, one subcommittee member persuaded Congress to mandate that the city hire more than 200 additional officers, and last year the congressman accused Barry of ignoring that mandate.

Dixon said members now feel Barry has solved that problem, with plans to take the force beyond the mandated capacity by this July.

Indeed, Barry may need the subcommittee's support on one budget issue that threatens to wreak havoc with his fiscal '83 plans -- the Reagan administration's proposal to force the city to assume a substantially greater share of the cost of treating the mentally ill at the federally operated St. Elizabeths Hospital.

During the two-hour session, members did question Barry on several areas that have recently caused controversy. Porter quizzed him on whether D.C. would be able to overcome serious foul-ups in the city's voter registration system that are theatening full voter participation in the September primary. The mayor said the Board of Elections would have an updated list of registered voters by the end of May and operate a hotline for voters to call in an attempt to straighten out the jumbled voter lists.