he Soviet Union took a guarded step toward extending the rights of workers to shape management policy by adopting its first comprehensive labor legislation today. The action followed one of the longest public debates in Soviet history.

Moscow's desire for such legislation seems to have been generated by the labor turmoil in Poland. It definitely was heightened by efforts of the new Soviet leader, Yuri Andropov, to revive the stagnating Soviet economy.

The new "law on labor collectives" was adopted unanimously at the closing session of the Supreme Soviet (parliament) after a nine-week public debate.

It appears to lay equal emphasis on labor discipline and worker participation and presumably was designed to provide Andropov with a tool for sharply raising labor productivity by getting people involved in management of their affairs.

Defining "the labor collective of an enterprise, institution and organization" as "the basic cell of socialist society," the law gives the collective a modest role in shaping management policies and the right to hold management accountable for implementing collective decisions.

However modest and vague this role may appear in the language of the law, it represents a major departure in this centrally planned system.

Until now, the Soviet leadership has seen no need to give workers more than a "consultative" voice in management since the Soviet Union has proclaimed itself to be a "workers' state." All existing labor legislation so far has been included in the civil codes of various Soviet republics.

Political observers here believe the new labor law is a prelude to economic reforms contemplated by the new leadership. Andropov assumed power last year at a time when the economy was reaching a state of crisis with falling industrial growth rates, a series of agricultural disasters, widespread corruption and inefficiency and a demoralized work force.

Moreover, Poland has frightened the party, and the Reagan administration's hostility has convinced it that the Soviet Union must put its economy on a sound footing for an anticipated long-term struggle with the United States.

Reformist forces in the Soviet elite have long urged decentralization measures and greater worker participation in management. However, the drafting of the new law began only two years ago, shortly after labor unrest in Poland and the emergence of the independent trade union Solidarity gravely challenged Communist rule there.

Despite the Polish turmoil, the new law met stiff resistance, particularly to the drafters' desire to extend the rights of labor collectives to the shaping of management policies. The greatest resistance came from the state and party bureaucracy, which feared that the cherished principle of yednonachalya, the vertical structure of authority, would be damaged.

Ironically, the Soviet state trade unions were also in the opposition, fearing that they would lose their role if labor collectives were given broader rights.

Shortly after he came to power in November, Andropov was reported to have pushed vigorously for a new labor law. The draft of the new law was published in April and was followed by a broad public debate.

A typical argument in support of the proposed law came from economists, intellectuals and workers who favored financial incentives, greater participation in management and less state control.

An argument summarizing the views of opponents was put forward by a Supreme Soviet deputy, V. Startsin. In a newspaper article he said that the provision giving labor collectives the right to shape management policies and hold top officers accountable for carrying them out "was calculated for highly conscious, honest and highly principled people." The "truth" is different, he added, arguing for "administrative" measures instead.

The leadership, however, seems to have believed that the majority favored the new law. It envisages two annual meetings at which the labor collective would make decisions. At such meetings, the collective would be able to exercise control over party, industrial and trade union officials who now run enterprises in cooperation with the state bureaucracy.

The law also appears to have dealt a fatal blow to the principle of uravnilovka, under which all workers get relatively equal wages irrespective of their work performance.

Political analysts here believe Andropov pushed the legislation through partly in an effort to improve the public climate and create an impression that he intends to give greater rights to the people. In this way, according to this line of argument, Andropov may be hoping to break apathy and raise labor productivity.

On a different level, the new Soviet leader may want to demonstrate that the Soviet economic model has not exhausted itself and that its regenerative capacity could include both greater labor discipline and a measure of worker participation.

The text of the law suggests that Andropov made a compromise with the conservatives. The labor collectives can shape plans of enterprises and criticize management at workers' meetings. But there is no mechanism for the collectives to deal with managers in the periods between meetings. The workers can recommend firings but cannot demand the appointment of new managers. Nor are they to have a direct voice on salaries since no wage bargaining procedures are mentioned.

In return, the collectives have to ensure greater labor discipline, raise productivity and "scrupulously" adhere to the state's production plans.

Today, after the Supreme Soviet session, Andropov began his duties as president, the post to which he was elected yesterday, by presenting high state awards to five persons, at least three of whom are his strong political supporters.

Aliyev and another Politburo member, Grigori Romanov, received the title of Hero of Socialist Labor. Politburo member Vladimir Shcherbitsky, the Ukrainian leader; KGB chief Viktor Chebrikov, a long-time Andropov assistant; and Gennady Sizov, the 80-year-old chairman of the party auditing commission, all received the Order of Lenin, the nation's highest civilian decoration.