D.C. Department of Human Services director James A. Buford, who two years ago took on the enormous task of heading the city's largest and perhaps most chaotic agency, has told the Barry administration he plans to leave his $52,000-a-year job in December, according to DHS sources.

Buford -- a soft-spoken and reserved bureaucrat whose department employs nearly 6,000 persons, spends more than $500 million a year and serves more than 100,000 persons through health, welfare and social service programs -- prepared a letter of resignation at least a week before the Sept. 14 mayoral primary, sources said, but Mayor Marion Barry would not accept it prior to the election.

Buford, in a brief interview, said he discussed his plans in August with City Administrator Elijah B. Rogers. Buford would not disclose details of that conversation.

"This catches me by some surprise," Buford said, when a reporter asked if he intended to resign. "I would much prefer to defer to the mayor to make any announcements that he would want to make."

Buford added, "At the present time, I am considering what my options are for the immediate future, which includes remaining at the department."

On Sept. 17, three days after the primary, Barry asked his 48 department heads and cabinet officers to turn in resignations, effective Jan. 2, so he would have a free hand reshaping the government over the next four years.

Barry is on a week-long vacation and Rogers would not comment on Buford's status. "It is pure speculation whether we are going to accept one or another resignation," Rogers said. "At the appropriate time, we will announce who will leave and who will stay."

Buford, 47, arrived in April 1980, and inherited what he called "a mess" at DHS, which had a $33 million deficit in 1980 and was reeling from staff cuts.The department was in such disarray that it was unaware how many employes it had and what many of them were supposed to do.

Buford supervised creation of a new computerized financial management system that is partially credited with bringing DHS's budget under control, reducing welfare errors, and recovering millions in federal funds that had been lost because of administrative foulups.

Buford was health and welfare director in Newark, N.J., and came to Washington in 1977 as a special assistant for the U.S. Department of Health, Education and Welfare to plan the reorganization of St. Elizabeths Hospital. He also served as a regional federal health administrator in Dallas.