District of Columbia officials are completing work on the 1982 budget, the first since the depth of the city's fiscal crisis was discovered, and already there are indications that the document will be unpopular with city residents and workers.

It is still too early to know which program reductions, personnel cut-backs or tax and fee increases might be necessary to accommodate the budget, which takes effect Oct. 1, 1981. But it is already apparent to D.C. Budget Director Gladys W. Mack and others involved in the sensitive process that the squeeze is on from two inexorable realities.

One is the city's shortage of funds, as inflation drives up costs faster than the city's income increases. The other, less noticed but equally inescapable, is a continuing erosion of the city government's control over how it spends the money it takes in.

In an effort to halt deficit spending, Mayor Marion Barry has directed that the budgets for 1982 and subsequent years be balanced in fact as well as in theory. This alone would mean city-wide reductions in staff and services without the demand of fixed costs.

But nearly 40 percent of all operatng revenues that the District expects to receive in the 1982 fiscal year are committed in advance to programs and services that must be financed regardless of other considerations.

Welfare payments, Medicaid bills, pension payments, skyrocketing transit subsidies and repayment of the city's debts will eat up an estimated $590 million of $1,517 billion in anticipated city revenues in 1982.

In a memorandum to School Board president R. Calvin Lockridge, Mack said that these are "costs over which the District has little or no control.

"This includes social services costs, such as health, public assistance and supplemental security income; retirement funds for teachers, police officers and firefighters; compensation funds; Metro system costs, debt service on capital improvements and repayment of the accumulated deficit. After these costs were funded, only $927 million was left for all District operating programs and services."

The growth in fixed obligations, which is part of a nationwide trend in cities and urban counties, means that correspondingly less money is available for optional or deferrable commitments, ranging from teacher salaries to street paving to trash collection.

Combined with inflation and rising energy costs, that ensures that the 1982 budget will require further staff reductions and service cutbacks that will hit "every department or agency in this government," Mack said in a memo to department heads.

The biggest block of mandatory costs is in welfare and Medicaid payments, which are still increasing despite the overall decline in the city's population.

As a percentage of the city's total revenues, however, these costs are relatively stable, and they have existed for so long that the budget-makers have learned to anticipate them. The obligatory costs that have upset the budget-making process are more recent and less predictable.

One is the repayment of the city's cumulative deficit, which is expected to total $409 million by the end of the current fiscal year on Sept. 30. Until this year, no such obligation has ever been acknowledged; now Barry's proposals for dealing with it will require outlays of $30 million a year beginning in 1982, money that must be diverted from operating programs.

Another is the Metro transit subsidy. In 1978, this obligation cost less than $30 million and consumed only 2.8 percent of the city's revenues. By 1982, it is expected to cost more than $90 million, or 6 percent of revenues.

"Metro costs are growing at an alarming rate with respect to the rest of the budget," Mack said in an interview. "By 1983 it will require some additional tax, perhaps a tax increase. The problem is not just for the District, but for the suburbs too. We may need some sort of regional tax to cover it."

The third is the cost of energy -- fuel for trucks, electricity for offices, heat for schools. Carroll B. Harvey, director of the Department of General Services, said last week that the city's total energy bills were $44 million a year ago and will be $75 million next year.

Energy-saving measures, such as the installation of minicomputers that monitor energy use in city buildings and turn off heat and hot water automatically, can do little more than chip away at this soaring demand on the city's money, Harvey said.

In the tomblike atmosphere of a District Building depopulated by the City Council's recess and the mayor's presence at the Democratic National Convention last week. Mack's office was one of the few busy departments because the 1982 budget deadline is approaching.

Unlike the suburbs, which prepare and adopt their budgets shortly before the start of the fiscal years, the District is obliged to act more than a year in advance so its spending program can be reviewed by the federal Office of Management and Budget and by Congress. Mack has to complete the budget in time for Barry to submit it to the Council next month.

Her procedure is to assign each agency or department head a "planning mark," or dollar amount that the department can expect to receive out of the total revenue that will be available.

The figures vary with the size of the department -- $238 million to the schools, $347,000 to the D.C. Auditor -- but the instructions do not. Each department head was told in a memo, "do not exceed the assigned FY 82 mark" in preparing spending plans.

Mack also told them:

"Direct program service personnel are to receive priority over administrative personnel, i.e. street and alley cleaners over program analysts."

"All cost-saving measures are to be explored, particularly in the rental and use of equipment and supplies, deployment of personnel and methods of delivering services."

"Recovery of full cost of certain services should be planned where feasible, i.e. permits, licenses and recreational services."

That probably means, Mack said, that fees will have to be charged for some services that now are free, such as public swimming pools, and raised for others.

"There is no question," she said, "that the departments will have less resources in '82 than in '81. But that's the challenge we face. We have been overprogrammed for a long time, and now we have to plan on the basis of the means that are within our control. Living within our resources is the only viable option."

She said it was a "question of mind-set. The community will have to understand that there are no other options. These decisions are not being made in a vacuum."