David E. Rivers, deputy director of the D.C. Department of Human Services for the past two years, was named by Mayor Marion Barry yesterday to be acting director of the department, replacing James A. Buford, who leaves at the end of this week.

Rivers is in line to be named to the post permanently after a trial period, city officials said.

Rivers, 39, said yesterday that he will be concerned with many of the same things Buford has been, particularly financial management and the need to save costs and increase productivity.

"Revenues tend to drive programs. We're just trying to deal with what we have got," rather than initiating new programs, he said.

Buford, meanwhile, was awarded a contract for up to $35,000 as a consultant on various DHS issues. These include Medicaid management, placing former mental patients into community living arrangements and budget and spending controls. Buford said yesterday he has two other contracts with private concerns and that he plans to specialize in the health-delivery field.

The Department of Human Services has more than one-quarter of the entire District of Columbia budget. It administers all health and welfare programs, including Medicaid, Aid to Families with Dependent Children and food stamps. The department also is responsible for child protective services, foster care programs and adoptions.

Rivers' appointment follows the unexpected change of plans by Dr. Bailus Walker, the man Barry was expected to name to the post at a press conference three weeks ago.

The day before the press conference, Walker announced to surprised city officials that he was going to take a job as commissioner of the Massachusetts Department of Public Health, the officials said. He is to start that job on June 6, according to the Massachusetts public health department.

Walker could not be reached yesterday to discuss what happened.

The mayor made the announcement of Rivers' appointment in a press release, saying that the continued association of Rivers and Buford "will provide the stability and smooth transition needed by this agency . . . . This arrangement will guarantee that the organizational and management improvements made since the agency was reorganized will continue and that ongoing services will not be affected."

One reason Rivers was put in on an acting basis was to give Thomas Downs, who becomes city administrator next week, a chance to put his seal of approval on the appointment, an official in the mayor's office said.

Buford brought Rivers in as his number two man in 1981. He has been involved mainly in administrative responsibilities and trouble-shooting, rather than in policy-making. Colleagues describe Rivers as extraverted, gregarious and socially active but say that he shares Buford's caution on policy issues.

Before going to DHS, Rivers worked in Atlanta as the city's commissioner of the budget, at the U.S. Department of Health and Human Services as a special assistant working with small and disadvantaged businesses, and in the U.S. Energy Department as director of city and county relations.

He has a master's degree in political science, public administration and public law and is working toward a PhD in public administration.