Western countries facing the grim challenge of scaling back overextended welfare systems while keeping social peace are getting a lesson from a most unlikely place--Belgium.

Formed only in the last century and torn by regular feuding between its two cultures, this tiny country has had a history of revolving-door governments rivaling Italy's frequent coalition shuffling. Belgium's patchwork political coalitions have been pulled apart 32 times in 39 years by squabbling between the Dutch-speaking Flemish and the French-speaking Walloons. Politically paralyzed, Belgium was incapable of grappling with a worldwide recession that by 1981 had left the country with one of Europe's biggest budget deficits--as a percentage of the gross national product--and its highest unemployment rate.

But under the belt-tightening of Prime Minister Wilfried Martens, the Belgians have found a surprising dose of political courage not seen in other European countries. Austerity has eluded the Italians, and the British have been cushioned from the recession's worst effects by North Sea oil revenue. In France, economic rigor imposed last spring brought swarms of angry interest groups into the streets.

In Belgium, however, Martens' center-right coalition has broken all recent records for political longevity while systematically attacking a generous wage and welfare system. His government, elected 20 months ago, is the first in seven years to have lasted more than a year.

Ironically, Martens credits the country's deep cultural rift with easing the passage of his Draconian economic measures. "Some people say that thanks to this Flemish-Walloon conflict the government can take severe measures in other areas without attracting the attention of the population," the prime minister said in a recent interview.

For example, while the government recently was preparing a third year of nationwide tax increases and cutbacks in social security and unemployment benefits, Belgium's two cultural communities were busy bickering over a regional issue. The more affluent Flemish objected to spending large amounts of tax money to bail out the ailing, state-owned Cockerill Sambre Steel Company, the backbone of Wallonia.

The row dominated the news for several weeks, and observers predicted that Martens' government would not survive. But last week, the prime minister appeared to settle the conflict with the announcement of a plan under which the central government and Wallonia will share the cost of restructuring the steel group.

When Martens took office, he was also bolstered by the Belgians' growing weariness with their government's lack of will at a time of deep economic crisis. By 1981, "Even the workers had become convinced that something fundamental had to change, that we were living beyond our means," the prime minister said.

Benefiting from this shift in public mood, the government was able to arrange a political cease-fire between the Flemish and Walloons in August 1981 by granting more autonomy to both regions. In elections three months later voters shook up the country's balance of power--the Socialists, who had brought down the previous coalition by rejecting a wage freeze, were denied a share of power for the first time in 14 years.

So far the Socialists, who are divided and lack a clear alternative to Martens' programs, have been unable to mount much of a challenge. Even the head of the activist socialist union, Andre vanden Broucke of the General Federation of Labor, complains of helplessness. He says he has not been able to stage a crippling strike for lack of support from the nation's other major labor organization, the Confederation of Christian Unions. But that union is not likely to lend a hand while its political affiliate, the Social Christian Party, is the most important partner in Martens' coalition.

"Other governments did not have the courage to take necessary actions," said the leader of the Christian union, Jeff Houthuys. "It was a question of saving the economy for the sake of employment."

When he took office in December 1981, Martens, head of the Flemish-dominated Social Christian Party, moved immediately to seize more authority. In his no-nonsense, almost charmless fashion, the 47-year-old lawyer from Ghent persuaded parliament to let him rule by decree in economic affairs, invoking the authority of Belgium's King Baudouin.

Then, on a single weekend, he violated the country's two economic taboos: he devalued the Belgian franc for the first time in 33 years, and he changed the country's rigid wage indexing system.

These steps, along with some trimming of welfare benefits and tax increases, have produced results. During the past year, the balance of payments deficit has narrowed from 4.1 percent of the gross national product to 3.2 percent; inflation has dropped from 8.7 to 7 percent; corporate profits have risen 20 percent--reaching levels they have not attained since 1973--and the budget deficit has shrunk for the first time in nine years, from 16.5 percent of GNP to 16.1 percent.

Last month, the Organization for Economic Cooperation and Development said Belgium "should now be well-placed to benefit from the recovery."

Unemployment has continued to climb, however, and is expected to reach a record 15 percent by the end of the year, and government expenditures still take an alarming bite out of the GNP. The two related problems are bound to worsen next year.

The steel industry must shed 8,000 jobs to meet the European Community's production ceilings. At the same time, 527 out of the 589 counties in Belgium, including the major cities of Liege and Antwerp, are in the red and will probably be forced into massive layoffs of municipal workers.

In the face of these destabilizing pressures, Martens has been careful to protect the most disadvantaged welfare recipients and to spare the lowest paid workers from the average 6 percent reduction in purchasing power during the past two years. Union leaders concede that both moves have made his bitter economic medicine easier to swallow.

Perhaps most original are Martens' remedies for unemployment. Under his government, Belgium became the first country in the European Community to make schooling compulsory until the age of 18, and the first to institute a work-sharing program. The government asked private sector employes to reduce their working hours and earnings so business could use the savings to create jobs. So far nine out of 10 workers in that sector have agreed to participate. The socialist union, however, claims that the government cannot possibly enforce the hiring.

The prime minister acknowledges that the work-sharing program is only a partial solution. In the short run, he also is counting on a U.S.-led economic recovery. In the long run, he said he hopes that work-sharing will become an institution of postindustrialized societies.

In the meantime, the government will be tested next year as it cuts deeper into the country's social security system with the aim of eventually overhauling it.

The prime minister insisted, however, that his coalition has been tempered by fire. "We're somewhat obligated to continue the job of reform because of the very fact that we've taken unpopular measures," he said.

Martens seems to have laid the ground for an economic recovery. Labor leader Houthuys begrudgingly gave Martens credit for having proved so far "that the population is more sensible than people think."