A Tehran newspaper today published what it said were excerpts from the interrogation of one of the American Embassy hostages in which he admitted to being a CIA agent and named two of his contracts.

The newspaper, Azadegan, did not name the American, but a reporter on its staff and one of the militant Moslem students occupying the U.S. Embassy later identified the hostage as Thomas Ahern, who is listed as the embassy's narcotics officer. The paper said the questioner was one of the captors.

The purported interrogation was contained in a document that the militants had submitted to parliament, which has been charged by Iranian leader Ayatollah Ruhollah Khomeini with deciding the fate of the hostages. The militants holding them advocate putting them on trial as spies.

If the published statements are accurate, it would mark the first time that one of the hostages has confessed to being an officer of the Central Intelligence Agency. The militants in the past have accused Ahern and several other hostages of being CIA agents, but had not previously issued transcripts of any interrogations in which such an affiliation was admitted.

Ahern was accused by militants shortly after the embassy takeover of holding a false passport.

The militants reportedly provided the purported interrogation and other documents to the parliament when it convened in late May. The date of the interrogation was not given.

Publication of the alleged confession came on one of the bloodiest days of wholesale executions since the revolution that brought Iran's Islamic Republic to power 17 months ago.

At least 28 persons were executed by firing squads in the last 24 hours in scattered locations throughout the country, according to the government-controlled news media.

Most of those executed were charged with narcotics offenses, but they also included two leading members of Iran's Bahai religious minority, a former deputy military chief of staff and an antigovernment student activist, according to the official news media.

The militants in the past have denied interrogating the hostages, but today's published account seemed to indicate that the militants had indeed done so. The State Department has said it regards any alleged hostage confessions of espionage activities in Iran as having been obtained under duress and therefore invalid.

There was no way to independently confirm the authenticity of the purported interrogation of Ahern. The newspaper that printed it usually reflects the views of the Islamic militants who have taken a hard line on the hostage issue. Publication of Ahern's alleged statements tended to bolster the militants' opposition to the seating of key moderates in the newly elected parliament.

In the interrogation Ahern allegedly admitted contacts with tribal leader Khosrow Qashqai, long an opponent of the shah, and former deputy prime minister Abbas Amir Entezam, who is currently in jail awaiting trial on charges of having had links with American officials here.

The parliament voted overwhelmingly yesterday to deny Qashqai credentials to sit in the legislature despite his election in March.

Ahern reportedly said Qashqai was not paid for his information about the security and political situation among his tribesmen in central Iran.

The published excerpt of Ahern's questioning mainly concerned the CIA's sources of information in Iran and their code names. Ahern reportedly said Qashqai had the code name "SD Rotter," while Entezam was known as "SD Pepper."

Asked whether Qashqai knew he was dealing with a CIA agent during his contacts with the U.S. official, the hostage replied, according to the newspaper, "I believe he knew that I am the representative of the CIA."

The paper said he added: "About the reason for his readiness to contact us, I do not remember that we had any discussion about it. There is no specific reference in the dossier about what his precise expectations from his contacts with me or other agents before me were."

The paper quoted the hostage as saying the Qashqai "used to give reports about one of the minorities in the country . . . about the security situation of one of the tribes . . . and about their relations with the local officials and central government.

In another development, opposing political groups exchanged charges of responsibility for an abortive military coup reported by the government last week. The Islamic Republican Party led by Ayatollah Mohammed Beheshti traded the accusations with the National Front, a moderate grouping that has been severely weakened by the dominant role of the Islamic Republicans and has seen several of its elected parliamentarians disqualified. r

The most prominent person executed was Lt. Gen. Houshang Hatem, deputy chief of staff of the armed forces under the shah, on charges of having ordered troops to fire on crowds demonstrating against the monarch during the rebellion.

A former officer in the disbanded imperial guard was also shot for killing a conscript soldier during the uprising. Both political executions occurred in Evin Prison in Tehran. Three policemen were also shot for similar offenses in Isfahan in central Iran.

Seven convicted drug offenders were killed by a firing squad on a street in a former red light district of the capital shortly after dawn. It was the second time in a week that the area was a scene of public executions, long a tradition in Iran but banished by the shah in the mid-1960s.

The open air executions were further evidence of the harsh turn that Iran's revolutionary justice has taken in recent weeks.

The largest number of overnight executions occurred in the northern city of Tabriz, where 14 persons were killed for sex and drug offenses and other alleged crimes.

Two of the 14 were Bahais, a sect regarded by Iranian Moslems as an offshoot of Islam and therefore heretical. According to the official radio, they were accused of "running the Bahais' centers in Tabriz, working for SAVAK [the shah's secret police], cooperating with international Zionism, giving financial aid to Israel and spreading prostitution."