BELGRADE -- With the fascination usually reserved for a hit television serial, many people here have been following the drama this summer of an old, well-known shoe factory called Peter Velebit.

Like hundreds of state firms around this economically beleaguered nation, Velebit, a chronic money loser, is facing a serious threat for the first time in its existence under communist rule. Unless it can find a partner or lender to cover its losses by Sept. 30, the firm is due to go bankrupt, and its employes will lose their jobs.

Across the communist world, bankruptcy has proved both one of the most vital elements of economic reform and perhaps the most difficult to implement. Without it, state-owned firms have no real compulsion to wean themselves of subsidies and unprofitable practices, and the economy has no way of shedding inefficient or wasteful production.

Yet if bankruptcies are carried out, valuable industrial goods may disappear from the market and unemployment will grow, violating the promise of job security that communist rulers have always offered their people.

"Government layoffs are a bitter pill for any country," noted a western diplomat. "But here they also have to deal with exploding one of the central myths of the ideology they've been preaching all these years."

Though a failed company would hardly rate notice outside the communist world, here it is a spectacle that has stunned Yugoslavia's workers and posed a crucial test to its rickety one-party political system. Rarely before in this country -- and only in isolated cases in the rest of the communist world -- has a major company actually been forced to close down because of its failure to make a profit.

Now, under the provisions of a new bankruptcy law, Velebit is one of 790 losing firms across Yugoslavia, employing about 200,000 people, for whom officials say time is finally running out. Despite a desperate scramble by managers and local bureaucrats for quick cash, government leaders insist that dozens and maybe hundreds of bankruptcies will be ordered after September, beginning a painful but desperately needed shakeout across all sectors of the economy.

In each of Yugoslavia's eight self-governing jurisdictions and in many cities and towns, big, overstaffed and poorly kept factories that have been the familiar landmarks of East Bloc socialism suddenly are fighting for their lives. Already, officials say, 17 firms employing 2,000 workers have given up, while scores of others have little chance.

While Belgrade watches Velebit writhe, the southern republic of Montenegro is gripped by the struggle of Cellulose, a huge white elephant of a factory that threatens to take an entire town, Ivangrad, into bankruptcy with it. Local officials are fighting to keep the firm alive, fearful of the social consequences of a shutdown.

At the national level, officials of the government of Prime Minister Branko Mikulic say they are bracing for another outbreak of protests that occurred in the country earlier this year in the form of an unprecedented wave of wildcat strikes. Workers who join Yugoslavia's already large pool of 1.1 million unemployed, they say, are likely to feel rebellious.

Nevertheless, government officials say the country's leadership no longer can afford to back down from its tough program to improve the socialist economy. "It's just impossible that all the firms will be bailed out," said Oskar Kovac, an economic minister in the federal executive committee, or Cabinet.

"There will be firms that will clearly have to go," Kovac said. "I only hope it will not take such dimensions that it will cause serious social unrest. But even with that risk we must go ahead."

Yugoslavia's attempts to implement its bankruptcy program in the coming months will be closely followed by such East Bloc neighbors as Hungary and Poland, which also have adopted bankruptcy laws but been hesitant to carry them out. In the Soviet Union, too, bankruptcy has emerged as a key element of communist leader Mikhail Gorbachev's plans to reform the centralized Stalinist socialist system with traditional tools of market capitalism.

That nonaligned Yugoslavia, more than its Soviet Bloc neighbors, is willing to take on the challenge, is explained partly by the country's longstanding role as a pioneer of reform and partly by the seriousness of its economic troubles.

Politically adrift since the death of Marshal Tito in 1980 and burdened by a huge foreign debt accumulated in his last years, Yugoslavia suffers from inflation of over 100 percent as well as unemployment of 14 percent. Real income declined 28 percent between 1979 and 1985 before recovering slightly last year.

Mikulic, who as prime minister holds the relatively most important post among a diffuse and institutionally weak cast of national leaders, took office last year vowing to bring the economy under control with decisive measures and end the autarkic practices of the country's six republics and two provinces.

Nevertheless, government officials concede privately that the aggressive prime minister, by freezing many prices and lowering interest rates, initially took steps that worsened the crisis. Inflation soared along with workers' wages, exports dropped and Yugoslavia's western creditors stalled on refinancing payments on the country's $19 billion debt.

Mikulic finally shifted course and since this year has pursued a policy of enforcing austerity in workers' wages and government spending to reduce inflation. He also has pressed reforms such as the bankruptcy law, a liberalization of prices and an expansion of both the private sector and opportunities for foreign investment.

Western bankers and diplomats support the government's plan and accompanying determination, but note that the federal administration has been overpowered in many cases by the resistance of the powerful republican bureaucracies.

Many observers believe that the bankruptcy drive, due to last until the end of the year, and an accompanying federal program to curb wage increases could be a pivotal test of Mikulic's ability to turn around the economy. It also could have a key influence on western creditors holding the $19 billion debt, who are expected to begin discussing a likely government bid for new postponements of payments in September.

Yugoslavia already requested a temporary postponement of $240 million in payments due this month, saying it was having a cash flow problem. A total of $5.5 billion in payments on the debt are due this year.

If the government succeeds in carrying out the bankruptcy drive, officials say, the victory will be at best bittersweet. "From a western point of view of course it's ironic that the government is struggling to liquidate enterprises," one official conceded. "But in our context that is a positive policy. That is the progressive step."