At the height of New York City's fiscal crisis four years ago, Johnny Carson joked that the city teetered on the brink of insolvency because its mayor, Abraham Beame, had walked under a black cat.

Such was the country's willingness to turn on New York as a sinner paying for decades of extravagance that even the stature of the five-foot-two Beame had become a subject of ridicule.

Today, neither New York's finances nor its new six-foot mayor, Ed Koch, are the butt of network jokes.

Dire predictions of "imminent bankruptcy" are no longer among the epithets headline writers use when describing the city.

Indeed, like many other national crises, New York's financial difficulties are a dim memory to most Americans.

Yet the city remains in the financial tar pits, kept afloat by a raft of federal and state aid and aiming to get its budget balanced by 1982 so that it can once again borrow on its own without federal or state cosigners.

Last Friday the state's financial control board accepted - with some modifications - Koch's $12.8 billion budget for 1980, signaling its approval of the steps the city has taken so far on the road to financial soundness.

The Carter administration also is required to give its blessing to the Koch budget, and is expected to do so.

To hear the mayor tell it, the city has made monumental strides since the dark days of 1975. Koch, elected two years ago, says proudly and often that New York not only will meet every goal that the state and the federal governments set for the city, but that New York is experiencing a renaissance.

City business has been increasing. Tax revenues are up. The city ended a decade of job losses totaling 600,000 by registering a 48,000 job gain last year. The budget is balanced, although not in terms most accountants would feel comfortable with.

Whether or not this adds up to a renaissance, even the city's critics agree that substantial progress has been made.

But despite the confidence that Koch and his Carter administration allies evince - assistance treasury Secretary Roger Altman echoes the mayor, "It'll be tough, but New York will make it" - the city has a long way to go. Moody's Investors Services, one of the organizations that must judge the city's credit rating, still refuses to give New York bonds a passing grade.

One thing is clear: New York is once again on the leading edge. No longer is it a pathfinder in dividing up tax dollars it had or didn't have among a blizzard of social programs. Instead, it is among the first into the age of shrinking resources, grappling ahead of most other government bodies with planned reductions, trying to make do with less.

The debate in New York is not over where the city is, but where it's going. It is a debate between Koch and the monitors established during the fiscal crisis, who watch New York's performance with a mandate to ensure that the city gets itself out of its financial hole and doesn't spend itself back in again. The city must take further belt-tightening steps to eliminate projected gaps of $400 million in fiscal 1981 and $800 million in fiscal 1982.

"It's the monitor's job to hold our feet to the fire. It's my job to get the city walking," Koch said in an interview.

The ebullient mayor is an optimist. "Fiscal monitors are paid to proclaim gloom and doom," he said. "Each one wants to be more conservative than the next."

The two black cats the monitors see in New York's future are the widely predicted national recession and a new round of contract negotiations with municipal unions next spring, both of which Koch's budget ignores, at least for the record.

Furthermore, there is growing disquiet among even those abservers friendliest to it that New York City does not have the political where-withal to take the painful steps to get its budget in real balance by 1982.

When Koch found last April that the ciyt would have higher revenues than originally projected for fiscal 1980 (which starts July 1) he spent most of it rather than using the windfall to reduce future deficits.

Attempts to close four of the city's 19 municipal hospitals - an essential first step if the city is to get its inefficient and wasteful health care system under control - have met stiff opposition.

"We're at the end of a yo-yo called the American economy," said Felix Rohatyn, one of the mayor's critics and chairman of the Municipal Assistance Corp. (MAC), formed to avert bankruptcy.

"We take a more pessimistic view of the general economy than the mayor does," he said in an interview.

Rohatyn and the other members of MAC told Koch recently that the city has benefited from a surge of inflation that has boosted tax revenues, as well as from stepped-up federal and state aid and an understanding approach to the city's debt by both MAC and the federal government.

"We do not believe these benefits can continue or recur at these levels," they said in a letter.

MAC called on the mayor to start immediately an attrition program to reduce the city's labor force by 4 percent, saying $65 million in the coming fiscal year and $300 million by 1982.

That is the year of truth of New York. The federal loan guarantees the city won from a grudging Congress - in good part because of former congressman Koch's credibility and performance - expire in 1982 and by then the city must be a budget balanced not by the laws of New York State but according to generally accepted accounting principles that do not allow using capital funds for current expenses nor permit the present way the city budgets its pension costs.

By 1982 MAC s ability to borrow on behalf of the city probably will be used up and the city will have to borrow long-term funds on its own again. That means New York not only must fulfill the legal requirements of a balanced budget, but also must persuade investors that it is a good long-term credit risk.

Early this year New York was able to sell $275 million to its own short-term notes to the public to get cash it needed to operate until tax collections come in. Although the sale was hailed by officials as a first step back to the credit markets that New York has been shut out of since 1975, it is one thing to borrow for four months in a booming economy with state backing and quite another to sell a 20-year bond.

Rohatyn and others praise the mayor, but think he is foolhardy not to tighten the belt more now.

"I'm not pessimistic that they can do it, if they get going," Rohatyn said of the city government. "The reason we're pressing for these early cuts is to avoid mutilation later on." A reduction of 6,500 workers in the city's roughly 167,000 city-paid labor force now would save as much as cutting 15,000 jobs in 1982, because of cumulative savings, Rohatyn argued.

Even Carter administration officials, who have been supportive of Koch, want the mayor to do more now.

Much of the reasoning is psychologicial. If the public perceives that New York - with a budget that does not reduce jobs - is not trying hard enough to rearrange its fiscal affairs, the city might never regain a rating that will permit it to borrow in the long-term credit markets.

On the other side, Koch said: "I think it would be the wrong signal to New Yorkers to say we're going to cut $100 million now. People and businesses would say, 'Why should I move back to New York?'"

Koch thinks people have become bullish on New York again and he doesn't want to frighten them away.

"I know we're going to make it," he said.

As a politican who has said he wants t serve three four-year terms, Koch also sees no danger in not making trims now and perhaps having to make them closer to his 1982 reelection campaign. He has the ball rolling the way he wants and dismisses the idea that continued good times for the city may be illusory.

Furthermore, as the treasury's Altman notes, those gigantic budget gaps that even the city's forecasters see for 1981 and 1982 have a way of shrinking as the year in question gets closer.

In addition Altman said New York has been spending less than the city thought it would.

But a recession and a large labor settlement could make the $400 million and $800 million gaps for fiscal 1981 and 1982 bigger, rather than smaller.

A 1 percent drop in the gross city product would cost $40 million in tax revenues. A 1 percent increase in property tax delinquency would result in a loss of $25 million in property taxes. Each 1 percent in wage increases costs the city $45 million in additional labor outlays.

Those are just some of the bad numbers that could be in New York's future.

Running New York City is one of the toughest political jobs in the world. Everying about the city is huge.

The $12.8 billion budget dwarfs all other muncipal budgets and all but a handful of state budgets. More than a third of that money is by state and federal grants that simply flow through the city to programs like welfare and Medicaid. They are not subject to any adjustment or alternate use by City Hall.

That leaves about $8 billion, but close to half of that is the city's share of fixed cost in welfare and Medicaid (a burden New York and only a handful of other cities carry themselves).

When people talk of cutting the budget, they are talking about the remaining $4 billion, in which the only significant place to cut is payroll.

In the spring of 1978, shortly after he took office, Koch got a low settlement of 4 percent annual raises for municipal workers, despite the much higher inflation rate in the nation.

"It was the best labor settlement in the country," the mayor said. Indeed, the settlement has made a large contribution to the city's financial success in the Koch administration.

"Civil service unions used to run the mayoralty," Koch said.

Now, the unions aren't running City Hall. In fact, they are helping to bankroll it. The unions agreed to put up large parts of their pension funds to keep the city from a bankruptcy that would have cost tens of thousands more city jobs and put those very pension funds in jeopardy.

"They're partners in the city treasury," Koch said. "They may not like it, but they are and that's helpful."

Victor Gotbaum, the leader of the largest municipal union, has become part of the establishment working to save New York. No longer are unions on the outside screaming for more while the politicians and the bankers sit in walnut-paneled boardrooms looking over the books.

Gotbaum was best man at Rohatyn's wedding recently and sits regularly with Citibank Chairman Walter Wriston and other financiers who have helped plot the strategy to keep New York afloat.

Gotbaum walks one of the thinnest tightropes in town.

"There's a mutual balance of terror," Rohatyn said of the labor negotiations coming up next spring. "The unions know that if they go too far, their pension funds are in jeopardy."

Nonetheless, Gotbaum said in an interview, the city workers are "thoroughly demoralized" because the last settlement left them lagging way behind the rising cost of living. "They are a frustrated, angry group," he said.

Both city and administration sources say privately that Koch's budget planners have made contingency plans to deal with settlements as high as 8 percent a year - which would add $360 million to the city's budget gap.

When New York went, hat in hand, to Congress in 1975, it promised it would never be back. It was back just three years later with the same promise, and congressional sources are worried that the city might forget its promise again.

So far, New York has complied with the law - which makes it hard to fault Koch on his 1980 budget. Even so, "the city is not doing any retrenchment this year. It was saved by the ecomony," said one top congressional New York watcher.

That is why Rohatyn publicly - and the administration privately - are pushing Koch to take more stringent steps than he has.

If the city finds itself unable to borrow in 1982 and deems another trip to Congress necessary, it will have to be without Rohatyn.

"I'm not going to do that again," he vows. "It's not in keeping with the city's commitment.