Seven people were killed and eight injured in attacks yesterday as Iranians voted in elections for president and to fill facancies in parliament.

Prime Minister Mohammed Ali Rajai seemed certain to win the presidential election, and Tehran radio said early returns gave him 15 times the number of votes as his nearest contender. He was backed by the dominant Islamic Republican Party, and the other three presidential candidates said they would vote for him.

Twenty-seven of the parliamentary seats being filled were to replace members of parliament among the 74 people killed in the bomb attack of Iranian Republican Party headquarters June 28.

Sources in Tehran said that deposed president Abol Hassan Bani-Sadr, in a clandestine radio broadcast the night before the elections, called on voters to boycott the elections. "I am your legal president. You have to resist. I am in Iran and will soon return," Bani-Sadr reportedly said.

The official radio said, however, that voter turnout was "extraordinary."

Despite heavy security measures, two Revolutionary Guards were shot and killed and one revolutionary committee member lost his life in a bomb attack at Tehran's police headquarters. In a suburb south of the capital, two people were killed and two wounded in an explosion at the local governor's offices.

In Rasht in northern Iran, two militant Moslems were killed and six people were injured in an attack, Pars, the government news agency, said without giving further details.

In northern Tehran, a ballot box was taken to spiritual leader Ayatollah Ruhollah Khomeini, whose health has appeared fragile during the past several months. Khomeini has described voting as a religious duty.