Two months ago, Lech Walesa was an unemployed electrician struggling anonymously for a cause

Today, he enjoys international celebrity as the organizer of Poland's victorious strikers, and he is being called on to turn his dream of independent trade unions into reality.

For the time being, that goal is being pursued in a large apartment that used to belong to a doctor specializing in venereal disease who decamped to West Germany. Now it is Walesa's union headquarters, and the scene there reflects his adjustment to the busy new life of the boss of a bureaucracy.

The time he allots for interviews these days is rationed to five minutes each, and one of his aides calls out the minutes as they pass.

Questions on how he organized the strike are disallowed. ("What are you doing, writing a handbook for strikers or something?" the questioner is asked.) Other questions are suggested and answered instead. For example:

Q. "What help do you need from abroad?"

A. "We need everything. As you can see we have nothing except for dirty walls. We need chairs, tables, telephones. Above all we need duplicating machines, typewriters, paper. Money too, but that is less of a problem. You must make a noise about it."

When the time is over, Walesa jumps up and exits like the chief cowboy in a western, taking half of the room with him.

Walesa's determination to get this simple message across to the hordes of foreign journalists pestering him for interviews reflects one facet of the skill he displayed during the strike. He understood that the struggle was taking place at several different levels -- and he changed his approach to suit what he wanted from each audience.

During the occupation of the yard, there were three immportant groups with whom he had to deal: the masses of ordinary workers milling around the main gate, the delegates from other factories who formed the integrated strike committee and the govenment commission headed by Deputy Prime Minister Mieczyslaw Jaagielski.

A Polish journalist commented: Walesa had a fantastic feeling of what was expected of him. The crowd around the gate were not interested in too many details. They wanted a symbol of their hopes. The delegates wanted detailed information and instructions to relay to other strikers. Jagielski wanted to do business. In each case, they got what they wanted from Walesa." w

"He behaved like a true statesman," the journalist added. "During the talks with government officials, he was calm and businesslike. With the masses outside, he became a demagogue. He knew how to keep them under control but once in a while he would make a show of force just to keep up the pressure on the authorities."

Walesa's hold over his followers proved decisive at all the crucial turning points of the strike. Right at the start, on Thursday, Aug. 14, he ensured that scattered protests over the dismissal of an elderly woman crane operator, Anna Walentynowicz, did not fizzle. Outside the yard when the trouble began, he climbed over the wall and began organizing the workers. Within a few hours, the strikers had drawn up a list of mainly economic demands.

On the third day of the strike, an abrupt change of heart by Walesa transformed the occupation into a national revolt.Agreement had been reached with the shipyard management on generous terms for going back to work. But the decision was greeted with dismay by strikers at other plants who were afraid that, without the support of the 16,000 shipyard workers, they would lose their bargaining power. Walesa persuaded the shipyard strikers to stay out in solidarity, and the movement for independent trade unions took off.

One of the delegates commented: That was where Walesa showed his greatness. He did not think just in terms of the benefits to be gained by workers at just one shipyard, but of all Polish workers. In the end, it became a movement for the renovation of the entire inefficient system. Practically every Pole supported those 21 demands."

Walesa, 37, did not emerge as a strike leader of genius overnight. His rise has its origins in Polish labor unrest a decade ago. Like many other Polish workers, he learned valuable lessons then and during the labor disturbances of 1976. Those experiences convinced him that only the establishment of independent trade unions could offer any hope of a permanent solution to Poland's problems.

The speed of Walesa's ascent reflects the swiftness of Poland's "proletarian revolution" (the phrase of a Polish government official). After a long period of gradual disintegration, the minimum ties of trust that are necessary between rulers and ruled suddenly fell apart. Now follows the slow, difficult process of trying to rebuild the social compact on a new basis.

Many Poles still have grave doubts about whether the government will allow the new independeent trade unions to represent the workers effectively. But senior Communist officials insist they will strictly respect the agreements reached with the strikers. As the mayor of Gdansk, Jerzey Mlynarzyk, remarked: "I think the new trade unions could be a third power in Poland -- that is, after the Communist Party and the Catholic Church."

Much will depend on the new union leaders, particularly Walesa himself. As an activist and organizer of strikes, he has already proved his brilliance. aAmong both followers and opponents, the consensus is that the 18-day occupation of the Lenin Shipyard here would not have achieved the results it did without his leadership.

At the end of the strike, Walesa displayed political wisdom in sensing the limits of the possible. A hard core within the strike committee presidium was unhappy with a stipulation that the new unions would accept the leading role of the Communist Party in Poland's political system.

For a few hours, it seemed as if the whole compromise might collapse. The authorities desperately needed some face-saving formula to prove to the Soviets that the foundations of the one-party state would remain intact. Walesa saved the day by delivering a rousing speech to the full committee in which he insisted that, as far as the responsibility of the new unions to look after the interests of their members was concerned, no "leading role" would be ceded to anyone else.

It was fitting that Walesa's first trip outside Gdansk since the strike ended should have been to Warsaw for a meeting with Cardinal Stefan Wyszynski, the primate of Poland. Like other strike leaders, he is a devote Roman Catholic and acknowledges the important role played by the church in keeping the workers' spirits up during the strike.

The cardinal adopted a cautious attitude towards the strikers, calling on both sides to show understanding. But he allowed local priests to conduct evening mass at the shipyard, which proved an exceptionally important morale booster.

For Walesa, the excitement of leading a mass revolt has not yet worn off. When he appears at a meeting of the new unions, the crowds chant his nickname, "Leszek, Leszek." When he walks down a street, people press forward to ask for his autograph or shake his hand. At his parish church, prayers are said for his soul "so that he may lead us to freedom."

His charisma is almost visible, and he seems to be thriving on it. A close friend remarked the other day that, despite nearly four weeks with little sleep, he was looking much younger than before the strike.

A decade ago, it was a different story.

In December 1970, when the Gdansk workers rebelled for the first time, Walesa had been working in the Lenin Shipyard for nine years. Born during the war, when Poland was under German occupation, he was a product of the hopes and disappointments of the postwar years. His father died when he was young, and his mother married again and emigrated to America. (She was killed in a car crash in 1976, and Walesa's stepfather now lives in New Jersey.)

The worker's riot in Gdansk a decade ago have been described by participants as "a volcanic eruption" and "a spasm of uncontrolled rage." After being refused a meeting with the local Communist Party chief, the strikers took to the streets.

Police fired into the crowds. According to an official report, 55 persons were killed. On Dec. 20, the Polish leader, Wladyslaw Gomulka, was forced to resign after suffering a heart attack. He was replaced by Edward Gierek, a genial former miner from Silesia.

The 1970 unrest in Gdansk lasted just four days, so there was little time to organize. But several leaders emerged, among them Lech Walesa.

Encouraged by Gierek's promises of open government and better living conditions, Walesa remained at the shipyard. In the first few years, life did improve. Wages rose, there was more to buy in the shops, and even the much-maligned communist-dominated trade union show signs of looking after workers' interests.

The boom in the Polish economy was paid for by foreign borrowings, however, and by 1976 the shortages and widespread discontent among workers had returned.

In July 1976, workers in several Polish towns rioted again in protests against increases in the price of meat. Gdansk was not directly affected by the unrest, but Walesa, who was then a delegate to the official trade union, drew up a list of workers' grievances. The management of the yard decided to get rid of a potential troublemaker and laid him off.

It was during the next two years that the idea for an independent trade union was born. At first its activists operated in conditions of conspiracy.

Contacts were made with dissident groups, including the Workers' Defense Committee, which was formed to assist strikers victimized as a result of the 1976 riots.

In 1978 the movement became public, and a committee of free trade unions of the Baltic coast was established. Among its half dozen or so members were Walesa and Anna Walentynowicz.

In January 1979, Walesa was laid off again, this time from a building company called Zrem. As in 1976, the real reason was his trade union activity.

He found a job with the Elektromontaz engineering plant. His colleagues found him "friendly and reliable" and "an excellent workman." The management, too, was pleased with his work, and he was officially declared the company's outstanding electrician. His only fault was his union activism. t

Last December, Walesa took part in a demonstration outside the Lenin Shipyard to commemorate the workers killed in 1970. About 5,000 people were present, and he addressed them about free trade unions. Several weeks later, he was fired from Elektromontaz, allegedly for taking a day off without permission.

A Western visitor who met Walesa in Gdansk shortly after his dismissal was struck by his determination and political awareness. He had just refused an offer of a highly-paid job in Libya because he wanted to remain in Gdansk. He spent a 15-minute taxi ride trying to convert the skeptical driver to the cause of independent unions. He also showed a keen interest in how trade unions operated in the West.

At the time, his dream seemed a faraway prospect. Walesa remarked to the Western visitor: "I think eventually there will be independent unions in this country . . . but not in my life-time."

Although Walesa appears to have achieved his ambition much sooner than he or anyone else predicted, he insists that the formal agreement with the government to set up the new unions represents "only one-third of a success." He adds: "We can still be defeated. We must establish ourselves permanently."