New antigovernment rioting broke out in the holy city of Qom yesterday, the third day of political violence across Iran that has killed at least 12 people in three cities.

The government condemned the "inhuman and antinational acts" of the demonstrators and said it will "no longer tolerate the riots and unrest" that have plagued Iran since the beginning of the year. It described the demonstraters as an unholy alliance of Communist subversives and Moslem extremists and hinted at a possible crackdown.

Conservative Moslem forces opposing Shah Mohammad Reza Pahlavi's modernization plans were behing major riots in January and February in Qom and Tabriz in which upwards of 100 persons were killed and hundreds were jailed, according to dissident reports. The government has consistently given much lower casualty figures.

The latest rioting - triggered by traditional mourning for the dead 40 days after the last incidents - apparently broke out Monday in Tabriz northeast of Tehran. By yesterday they had spread to 20 cities, according to the Tehran newspaper Kayhan. Unofficial reports put the death toll as high as 50.

The worst disturbances appeared to be in Qom, 100 miles south of Tehran and the country's most sacred city to conservative Shiite Moslems.

Reports from the town said dissidents leaving a funeral service in a mosque ran wild through the streets for 10 hours Tuesday, burning Banks and shops, setting up street barricades, faighting police, halting trains, smashing buses and cars and roughing up passengers.

Troops fired tear gas and submachine gun bursts into the air as mullahs, Moslem holy men in black robes and turbans, marched on a police station. Witnesses said some of the demonstrators waved red flags.

The Persian-language Tehran newspaper Ettelaat said nine people died in the rioting. Other reports said hundreds were injured, including 10 policemen and 300 bus passengers.

They said officials cut off Qom's electricity in the evening, plunging the city into darkness, but the rioting continued until 10 p!m. Ettelaat said the disturbances broke out again yesterday but gave no fresh details.

Reports from Kazeroun said one person was killed during rioting by an estimated 500 protesters. In Tabriz Monday, at least two students were killed in clashes with police.

There were also reports from Shiraz that students were attacking shops, banks, bars and cinemas.

Police in some towns reportedly fired into the air and used water canon to break up the mobs.