When the director of a gas-equipment factory in Vilnius, the capital of Soviet Lithuania, left lying idle "big sums of money" allocated for employe housing, workers at the plant complained to their trade union.

The result, the official Soviet news agency Tass reported recently, was swift and severe: The factory director lost his job.

The firing of a negligent factory boss, Tass said, was another example of how Soviet trade unions are "guarding the interests of workers."

The Tass report itself was yet another example of a stepped-up public relations effort by the controlled Soviet press to polish the image of the country's centrally controlled, party-dominated unions.

The effort comes at a time when half of Poland's work force has abandoned the Soviet style of labor organization in favor of independent unions. While few experts believe that the idea is likely to catch on among relatively docile Soviet workers, reports of major work stoppages in Soviet automobile plants last year presumably have heightened Moscow's nervousness about the Polish developments.

Along with a flurry of newspaper reports extolling the good deeds of Soviet trade unions in such far-flung places as Vilnius, Dushanbe, Minsk and Ashkhabad, the weekly Literary Gazette recently devoted a full page to the inner workings of the Central Trade Union Council in Moscow.

Although the council, which governs the country's 30 trade unions, is said to work with "open doors," the newspaper observed that "not everyone has a correct idea of how this organization works."

Political journals have contributed with weighty dissertations on the role of labor unions in Marxist-Leninist society, and a new, 400-page collection of Lenin's thoughts on the subject has just been published.

Lenin, the Communist Party newpaper Pravda noted in a long review of the new book, took a dim view of "so-called free trade unions." Without mentioning their emergence in Poland, Pravda recalled that Lenin considered the concept to be "either a bourgeois provocation of the crudest sort or an extreme stupidity."

Observers here have noted the sharp increase in the quantity of material about how the labor unions are the protectors of the workers' interests.

"This is being done, of course, to calm public opinion," according to one Soviet observer.

Press reports uniformly take the occasion of a local union's accomplishments to repeat standard encomiums about the strength and influence of trade unions in Soviet society.

"Management," Tass said in recounting the firing of the factory boss in Vilnius, "can take no decisions involving the interests of the working people without the trade unions' consent."

With one exception, recent newspaper reports have given no figures that might indicate whether the firings of factory directors or court victories on the part of the dismissed workers are rare or commonplace events.

In its report on the Vilnius factory boss' dismissal, Tass did say that "this year alone," in all of Lithuania, with a population of 3.4 million, the Baltic republic's trade union council had considered "more than 20" grievances against management and that all were decided in favor of the workers. The small number of complaints suggests either a remarkably placid force or that new grievances ever reach the upper levels of the trade unions.

The report from Vilnius coincides with persistent rumors of brief, isolated strikes in Lithuania and other areas near the border with Poland. Soviet authorities in recent weeks have turned down requests from diplmats and journalists to travel in Lithuania.

Not surprisingly, the current public relations effort has stressed what unions do for workers, rather than what unions ask workers to do for the state.

Soviet labor unions bear only a superficial resemblance to those in the West. The Society variety is at least as much a device for controlling workers and indoctrinating them -- "a school for communism," in the words of Soviet President Leonid Brezhnev -- as an advocate for the traditional union causes of health, safety and higher standards of living.

Theoretically, membership is voluntary, but virtually everyone joins (there are 127.3 million members), partly because Soviet citizens regard nonconformity with almost pathological suspicion but also because unions are the main dispensers of fringe benefits such as nursery schools, cut-rate vacations to health spas, access to sports and cultural facilities and even, in many cases, to housing. Dues average about 1 percent of the worker's salary.

Almost every factory or other work place has its union committee, in which Communist Party activists play a key role. Rather than functioning as an adversary of management, Soviet trade unions form a bridge from the party and from management to the workers.

Since, in theory, the state is fully answerable to the Soviet workers, strikes are said to be unnecessary. Being unnecessary, they are banned, along with nearly every other kind of spontaneous demonstration. As an instrument of state, unions are charged with seeing to it that workers fulfill the production quotas handed down by central planning authorities.

Russians endure a lower standard of living than most East Europeans, including Poles, and are currently suffering serious shortages of meat and dairy products. Even potatoes and cabbage periodically disappear for a week or two from some districts of usually well-fed Moscow.

Yet the level of discontent among ordinary Soviet citizens, imbued with what a veteran Western diplomat calls a "docile patriotism," appears to be far below that of volatile Poland.

What the Soviet government fears most, foreign analysts say, is a linkup between disgruntled workers and dissident intellectuals, such as the conjunction that catalyzed Poland's upheaval.

This seems at most a distant possibility. The vastness of this country, its polyglot ethnic makeup, the tight controls on all forms of communication, the strength of the party and the police -- all these militate againsts widespread movements among workers. The few surviving dissidents among those known publicly are concentrated in Moscow.

Despite these odds, the last two years have brought at least two attempts to form independent labor unions. Both were quickly suppressed.

Vladimir Klebanov, formerly a foreman in a Ukrainian coal mine, tried in late 1977 to organize an independent union to fight for better working conditions. According to dissident sources, he is now in a psychiatric hospital undergoing compulsory drug treatment.

A second group, calling itself the Free Interprofessional Association of Workers, appeared in Moscow in 1978. The secret police quickly quashed this one as well, sending leaders to a psychiatric hospital.

An incident here recently suggests that Soviet authorities, while extolling the virtues of official unions, are unwilling to tolerate even the smallest public display of worker discontent outside their closely supervised confines.

By local standards, it was a strange and unnerving manifestation of unhappiness by a man evidently at the end of his tether. As workers streamed into a Moscow factory on a Monday morning one of them stopped before the gate and uncovered a homemade placard that read, "I am on strike for my rights as a worker."

Neither the worker's identity nor his complaint is known, and neither is likely to become known. Uniformed police oficers, according to a variety of sources, quickly hustled him off to a psychiatric hospital.