The Polish parliament today approved an amnesty law giving prosecutors and judges wide latitude to release political prisoners but suggesting some conditions that may exclude many jailed leaders of the banned Solidarity trade union.

As communist leader Gen. Wojciech Jaruzelski looked on, the national assembly voted 348 to 0 for legislation that would give authorities flexibility to free prisoners unconditionally or, in some cases, require that they first cooperate with police or sign pledges not to engage in opposition activity.

There was no official indication today of how many prisoners would be released unconditionally under the law. However, western sources said a senior official told a visiting Australian parliamentary delegation today that 246 of the estimated 320 or more political prisoners would be freed.

The measure, which also provides for a large-scale release of common criminals, appeared to give Jaruzelski's government the power to freely restrict or expand the release of opponents over the next two months, opening the possibility of behind-the-scenes negotiations with the Roman Catholic church and western governments that have pressed for action on the issue of political prisoners.

A large-scale release of prisoners has been described by western diplomats as an important condition for improved relations between Poland and the West. U.S. and other western officials said reaction to the new measure would depend on how the cases of important opposition activists were handled.

The new law seemed designed to put pressure on Solidarity leaders who have been jailed repeatedly in the 4 1/2 years since the union's suppression. Political observers said the amnesty provisions would probably force top opposition activists to choose between pledging not to engage in further illegal activity or remaining in jail.

Most Solidarity leaders are expected to reject the government's conditions, allowing authorities to argue that they have willfully prolonged their own imprisonment. The government pursued a similar tactic in 1983, when it began the first of its three previous releases of political prisoners.

Estimates of the total number of political prisoners by the Roman Catholic church and western diplomats range from 320 to 350. No official figures have been provided since last year.

First formally announced by Jaruzelski at the congress of the ruling Polish United Workers Party two weeks ago, the amnesty measure has been portrayed officially as "a last chance" for government opponents to give up resistance to Jaruzelski's program of "normalization" of Poland.

The text of the law approved by the Sejm, or parliament, today said that the measure was possible because of "the progressing normalization of social life and the strengthening of the socialist state" and that those prisoners affected must show they will "actively join in the country's life and never go back to the road of offenses."

Among the best-known activists now being held are historian Adam Michnik, convicted with Solidarity activists Bogdan Lis and Wladyslaw Frasyniuk last year on charges of trying to organize a strike; Czeslaw Bielecki, a former architect and underground publisher who has carried out a hunger strike since last October; and Zbigniew Bujak, the head of the Solidarity underground for more than four years before his arrest on May 31.

The Sejm action on the amnesty law came on a day when thousands of people gathered in Warsaw for the funeral of Edward Lipinski, a leader and father-figure of the Polish opposition during the 1970s. Lipinski, a founder in 1976 of the Workers' Defense Committee, the major opposition group before Solidarity, died last weekend at the age of 97.

In an unusual conciliatory gesture, the Polish news agency and other official media provided information on Lipinski's death and funeral, and the Warsaw newspaper Zycie Warszawy printed a flattering obituary in the form of a letter from "students and friends."