Slowing revenue growth and rising costs have prompted San Francisco Mayor London Breed to mandate belt-tightening in an effort to stave off a budget deficit as the city steps up spending on homelessness and mental health.

Breed issued instructions Monday calling on city departments to find ways to shrink their budgets by 3.5% in each of the next two fiscal years to deal with a projected $420 million budget shortfall over those fiscal years.

That shortfall is nearly 55% higher than the previous budget.

Breed’s directive marks the start of San Francisco’s months-long budget-setting process. Departments now have until March to tinker with their finances and figure out how to shed 3.5% of their draw on the general fund by finding new sources of revenue and places to cut costs. The city is legally required to pass a balanced budget each year by Aug. 1, and the reductions will be key to closing the sharply rising deficit.

The mayor also underscored that providing housing, shelter and services to the neediest San Franciscans — namely the 4,000 homeless, addicted and mentally ill people drifting on the city’s streets — represented her chief budget priority.

“We have to focus our spending on the biggest challenges facing the city, which is why I have directed departments to prioritize funding for the homelessness, mental health and addiction crises we see on our streets,” Breed said. “This is going to require hard choices in the upcoming budget process, but we have a responsibility to balance the budget, and I am going to make sure that happens.”

The cuts will affect all departments tied to the city’s roughly $6 billion general fund, in contrast to “enterprise departments” like the Municipal Transportation Agency, the airport and the Public Utilities Commission, which generate their own revenue through service charges.

Much of the city’s work to address homelessness, addiction and untreated mental illness will revolve around adopting an ambitious plan passed by the Board of Supervisors last week to overhaul the city’s behavioral health care system. Mental Health SF, written by Supervisors Hillary Ronen and Matt Haney, is expected to cost $100 million annually once fully up and running. Much of the plan will be funded with new revenue sources.

Some of those sources are expected to come out of a sweeping study of the city’s patchwork of business taxes that the City Controller’s Office is expected to release in the spring. Business taxes specifically are the second-largest source of revenue for the city’s general fund.

City budget and finance officials blame the projected shortfall on slowing revenue growth from a variety of sources colliding with ever-rising salary and pension costs and other expenses.

While big-picture U.S. economic forecasts seem rosy, in San Francisco years of soaring growth are showing signs of slowing — contributing to the shortfall city officials are now scrambling to remedy.

City Controller Ben Rosenfield pointed to several revenue streams that are expected to slow in the coming years, including property taxes, which were driven higher in recent years by the assessor-recorder’s office catching up on a backlog of assessments. Transfer taxes — levied when properties change hands — are expected to slow after years of torrential, record-setting activity.

Hotel room rates are also plateauing, Rosenfield said, cutting into revenue from hotel taxes. Historically low interest rates have prevented the city from accumulating interest on its cash reserves. And after several years of employment and wage growth in the private sector, business taxes overall are expected to grow at a slower rate in the coming years.

“The extraordinary level of economic and tax revenue growth we’ve seen in recent years is moderating. The mayor and board will face tougher choices this year,” Rosenfield said.

Dominic Fracassa is a San Francisco Chronicle staff writer. Email: dfracassa@sfchronicle.com Twitter: @dominicfracassa