D.C. Mayor Marion Barry and President Reagan agreed on one thing in announcing their respective budgets recently: The national economic recovery has aided local governments by increasing tax revenues and lowering public assistance needs.

But the conservative Republican president and the liberal Democratic mayor parted company on what that should mean for local programs. If Reagan gets his way, much of Barry's attempt to add programs and aid for the needy would be canceled by federal cuts.

"Financial management and fiscal integrity build a basis for progress, but they are not its heart," Barry said in his budget message. "It is programs . . . that determine our quality of life and the vitality of our city . . . . The fiscal 1986 budget is about people, about progress and about programs."

After adjusting spending for increased costs of current services and for pay raises for city employes, the city government figured on having about $100 million in increased revenue left to spend. Barry proposed using this largely for health and housing, education, emergency assistance and shelter, job programs and initiatives to help the elderly, troubled youths and distressed neighborhoods.

Reagan's budget drafters saw it differently. Announced last weekend just days after Barry's budget came out, the administration's proposal indicated that the new-found wealth of state and local governments meant that it was time to stop sending large amounts of aid to and through those governments and to pull back on social service programs.

"Most local governments are able to finance their own public services. In the current fiscal environment, federal revenues must be used to support national needs and priorities," a Reagan budget analysis stated.

The Reagan budget proposes eliminating general revenue sharing, from which the District had expected to get $17.7 million in fiscal 1986. While this is less than 1 percent of the city's budget, the city had counted on it to fund improvements in crime prevention, firefighting, current teachers' pension benefits, road repairs, general public assistance and mental health.

Reagan wants to freeze payments to Medicaid, which has been one of the fastest growing programs in the city budget; Aid to Families with Dependent Children (AFDC), the basic assistance program; food stamps, and social services block grants at 1985 levels.

Barry's proposed budget anticipated federal freezes in health and social services block grants. But the city expected to get a $6 million increase in federal funding of Medicaid, for a total of $166.7 million, and nearly $3 million more for AFDC.

Thousands of city residents rely on these programs. More than a fifth of the income of District residents comes from government payments such as retirement, unemployment, health insurance and income maintenance programs, according to city budget documents.

Sharp proposed cuts in federal housing programs, and an end to the Urban Development Action Grant (UDAG) program, would have a significant impact on the city's housing and economic development plans.

Sixty-five percent of the $103.6 million the city planned to spend on housing programs in fiscal 1986 was to come from the federal government. Community Development Block Grants, which represent 20 percent of the city's operating budget for housing, are proposed to be cut by 10 percent nationally, with more of the total going to rural areas.

"We didn't anticipate that in our numbers," said Madeline Petty, D.C. director of Housing and Community Development. Petty said the city is hoping that Congress will not go along with what the president has requested.

The city had budgeted a $1.3 million increase to $27.7 million for low-rent housing, but Reagan wants to freeze low-income rent subsidies.

Officials also anticipated getting seven UDAG grants totalling $12 million in fiscal 1986. The city wanted to use these mainly for revitalizing distressed neighborhoods, and it has plans on the drawing board for hotel projects and a major development in Northeast, for example, said Kwasi Holman, executive director of the D.C. Office of Business and Economic Development.

"It would mean a lot of these projects may not happen," said Holman. "We are looking closely at this."

The city in the past has received five UDAGs, Holman said: to help build the Hechinger Mall on H Street NE, a shopping center at Fourth and Rhode Island Avenue NE, and the Gallery Row development at Seventh and D streets NW; to convert the Bennett Building at 14th and U streets NW into office space, and for a home improvement program in the same area.

The Urban Development Action Grant program "is a critical tool in our economic development program, and one we were hoping to increasingly rely on," said D.C. Budget Director Betsy Reveal.

Reveal and budget officials in other cities say there are basic flaws in the president's argument that state and local governments can afford to fund their own programs because of recent budget surpluses.

"That is a slick argument but not a very fair one," particularly since local financial conditions can vary widely from year to year, Reveal said. "It's not very cricket to say a cash surplus in one year is a reason to cut back domestic programs 20 percent."

The District may come out better than other large cities, however. The city's primary source of federal funds is its annual federal payment in lieu of taxes, something no other city gets. The president decided to freeze the payment at its fiscal 1985 level of $425 million, which will represent about 19 percent of the District's budget.

New York City would see its federal funding drop from 14 percent of its revenues to 13 percent, and this would compare with 20 percent in 1979, said Alair Townsend, director of New York's Office of Management and Budget. Revenue sharing alone is $271 million for the city, about 1 1/2 percent of the budget, she said.

The direct impact of the cuts on Philadelphia would be about $200 million, including an end to $45.2 million in general revenue sharing, said W. Oliver Leggett, Philadelphia deputy mayor. Though the Pennsylvania state government has a surplus of nearly $200 million, "it's not the same in the cities," Leggett said.

The U.S. Conference of Mayors on Thursday estimated that federal grants to state and local governments have been cut in half after inflation is taken into account.

In the District, some social service advocates -- who in other recent years have blasted Barry for proposals to slice into programs for the needy -- this year have only mild objections to his fiscal 1986 budget.

"The District has done a wonderful job of trying to make up for the federal budget cuts, but there is still an unmet need there," said Peter Rice, coordinator of a Washington area coalition of social services organizations. But the mayor's budget, on which Rice was commenting, would have to be rearranged if the further federal budget cuts go through.

Barry says he is waiting to see what Congress does. Reveal said she does not see any area that the city will not be able to handle.

"It's going to be manageable," she said, "but it is not going to be easy."