The Iranian government announced yesterday that it will grant amnesty to all political prisoners. It did not say when the order would take effect or how many persons would be freed, but newspapers reported that at least 1,000 would be released.

Although the move appeared to be an effort to quiet opposition to the shah, anti-shah demonstrators clashed again with police in the holy city of Qom, and drawn-out strikes that have shut down ports and post offices continued to disrupt communications and food distribution.

The amnesty was announced by Justice Minister Mohammed Baheri on Radio Iran.

"From now on, there will be no political prisoners in Iran," Baheri said. "Only those convicted of terrorist activities or acts against state security will face imprisonment."

Baheri said prisoners will be conpensated for their imprisonment, but gave no details. His declaration followed reports that people have been jailed simply for reading or exchanging books banned by the secret police.

The announcement came a little more than two weeks after the shah's grant of amnesty to Iranian Shiite Moslem leader Ayatollah Khomeini, who has lived in exile for 16 years, and all Iranians abroad who have been involved in "antistate" activities.

In the past, hundreds of students who have demonstrated against the shah in foreign countries have been jailed upon their return home, and Iranian dissidents have been skeptical of government expressions of forgiveness.