BUDAPEST -- A frown creased the face of Karoly Grosz, prime minister and Communist Party boss of Hungary, at the mention of neighboring Romania. ''Do you know what the people in Romania used to light their houses before candles?'' Grosz asked, his eyes narrowing another two millimeters.

I confessed that I had no idea. ''Electricity,'' the prime minister said. A Soviet bloc leader telling a joke at the expense of another Communist country during an interview is a rare moment in history. But Romania's continuing descent into economic disaster and social disintegration cannot be ignored here, as it can elsewhere. Geography and ethnic ties compel Hungarians to take a direct interest in the forced march toward the Middle Ages that Romania has started.

The rest of Europe and both superpowers watch the unfolding of this modern tragedy with varying degrees of indifference and impotence. Their policy toward Romania has become an unspoken wish for the country's feudalistic ruler, Nicolae Ceausescu, to step aside or to die. Only then, Washington and Moscow seem to believe, can change come.

Ceausescu, age 70, shows no signs of obliging on either score. He has installed his wife Elena and a score of other relatives in top party posts and ruthlessly eliminated any other possible successors in the government. He runs Eastern Europe's most repressive security apparatus, which has co-opted up to one-third of the population to report any political dissent by their fellow citizens.

Severe food and fuel shortages pushed workers into the streets last winter in protests that were put down brutally in the towns of Brasov, Timosoara and elsewhere. Ceausescu has responded by refusing to change his economic priorities, which amount to spending the nation's money only on prestige projects that feed his megalomania. He obsessively repays the outstanding $6 billion of foreign debt, often in advance.

The result has been the impoverishment of a country that once was the region's breadbasket. Hungarians with relatives in Romania speak of children there, age 5 or older, who have never tasted chocolate, and who do not know what fresh fruit is.

An estimated 10,000 to 20,000 refugees have fled into Hungary from Romania as conditions have worsened. Many more will come pouring across the frontier if Ceausescu pushes ahead with a campaign announced in March to raze half of his country's 14,000 villages by the year 2000. Ceausescu asserts that the peasants have to be moved into apartment buildings and agriculture more fully ''systematized'' by eliminating individual farms.

This campaign would in fact destroy the homes and cultural identity of many of Romania's nearly 2 million ethnic Hungarians and 250,000 Germans, whose lands were incorporated into Romania as the price for being on the losing side in World War I.

The horror show next door also has indirect consequences for Hungary and the other Warsaw Pact nations. ''How can we tell young people that socialism is worth striving for if what is happening in Romania is done in the name of socialism?'' one Hungarian official asked.

In Ceausescu, the Soviet Union faces many of the dilemmas that the United States faced when Ferdinand Marcos appeared determined to drag the Philippines down with him rather than surrender power. But Moscow shows no signs of exerting the kind of influence or pressure that the United States used to cut short the Marcos syndrome.

It is ironic that in the one case where many abroad would welcome Soviet intervention in Eastern Europe, Mikhail Gorbachev appears to have no policy except to outwait Ceausescu and to hope for a palace coup after his death. Gorbachev appears to feel that any action that smacks of intervention will damage his credibility.

Hungarians, as concerned as they are about the growing instability on their border, draw back when the subject of intervention is raised. They clearly want to avoid encouraging Moscow to think that intervention in Eastern Europe is still an option. They have too much invested in perestroika to see it undone by Gorbachev's becoming bogged down in trying to resolve the Romanian crisis.

Ceausescu has been willing to isolate his country in order to reduce the pressure that can be brought to bear on him to step down. But the Soviets do have leverage, in the form of energy supplies and other trade, to stop or moderate Ceausescu's excesses against his own people. It would be a sophisticated diplomatic exercise worthy of the claims Moscow makes for its style of New Thinking in foreign policy. The alternative can only be more suffering for the Romanian people and a stain on Gorbachev's record of leadership.