After 25 years as an obscure Iranian civil servant at home and abroad, Ali Akbar Tabatabai had emerged as a leading crusader here in a worldwide campaign to bring democracy to his violence-torn country.

So frequent were his radio and television appearances -- and so vehement his criticism of Ayatollah Ruhollah Khomeini's rule -- that friends and diplomatic acquaintances of the Iranian exile agreed yesterday that the quiet, former press attache at the Iranian Embassy here had knowingly thrust himself into the kind of prominence that made him a target for assassination.

"He decided to go around and organize . . . to fight the regime we have now," said his twin brother, Mohammad Reza Tabatabai. "We talked about that [the danger] . . . but persons involved in political life have those kind of things in the back of their heads."

In the months since his country erupted in a bloody revolution against the shah, Tabatabai had founded and become president of the Iran Freedom Foundation, based in Bethesda. In recent days he had been busy organizing and publicizing an anti-Khomeini demonstration scheduled Sunday in Lafayette Square.

It was an unaccustomed role for the short, stocky and well-dressed 49-year-old former embassy spokesman, who had become a familiar dinner party figure around town. He traveled the country trying to raise money for his foundation, and he told those he met in Washington that he wanted Iran to have a democratic government at long last.

"He talked in a very sad and sorrowful way about what had happened in his country," said Georgie Anne Geyer, a journalist who met Tabatabai at dinner last month and was touched by his concern for his people.

A lawyer and architect by training, Tabatabai was at ease in the United States. He had adapted well to Western culture and the English language during the years he studied in college here and had worked in the Iranian Embassy under former ambassador Ardeshir Zahedi in the mid-1970s.

According to his brother, a Washington businessman, Tabatabai first came to the United States in 1952 and soon afterward enrolled as an architecture student at Howard University, though he had already earned a law degree in Iran. For awhile he worked at the Voice of America here, then took a minor staff job at the Iranian Embassy. He continued going to school part-time, graduating from Howard with a bachelor's degree in architecture in the early 1960s.

But Tabatabai's government service left him little time to pursue either architecture or law. He returned to Iran after he graduated from college and worked in Tehran as the government's director general of press and information. In the fall of 1975, he came back to the embassy in Washington as press attache and was later promoted to the job of press counselor.

Though Tabatabai was described yesterday as having never been an enthusiastic supporter of the shah, he nevertheless worked in his government for seven years and was moving up the diplomatic ladder in Washington when the shah fled Iran.

After the revolution, his brother said, Iranian revolutionaries called Tabatabai into the embassy two or three times for interviews about his future.

"They asked him to go back to Iran . . . but he realized there was no way for him to go back and cooperate with (Khomeini)," Tabatabai's brother said.

"The killing had started . . . social restrictions started taking place. He decided just to go ahead and start the foundation for the purpose of installing a secular form of government in Iran."

Tabatabai asked for and received political asylum here in May 1979, and started the foundation a month later.

The brother said that at the time of Tabatabai's decision to stay in the United States, some of Khomeini's supporters had accused him of working for SAVAK, the shah's secret service.

Though Tabatabai denied the accusation, his brother said yesterday that returning to Iran as ordered would have been risky.

"They did not tell him what they were going to do with him," he said.

Tabatabai, whose English was described as flawless and who frequently acted as a government guide for Americans visiting Tehran, lived in affluent style here. His home in a quiet Bethesda cul-de-sac was furnished with expensive art works and Iranian artifacts.

He spent much of his time trying to discredit Khomeini in the eyes of foreign governments, and said there were pro-Khomeini groups in this country seeking to further the ayatollah's cause.

The Tabatabai family was one of the biggest and best known in Iran, with a family tree dating back 500 years, according to the brother.

The former embassy official had married an American, from whom he was divorced in the early 1960s, and has a teen-age daughter in this country.

Tabatabai told one acquaintance that the task of heading the Iran Freedom Foundation fell to him because he was unmarried and other Iranian exiles were fearful of jeopardizing their families. He told one radio interviewer that he began receiving death threats in telephone calls at his office and home almost from the day the foundation announced its existence.

Tabatabai's brother, who has not taken an active political stand against Khomeini, said yesterday he would work to make sure the anti-Khomeini demonstration takes place as scheduled this Sunday because the event had been so important to his brother.

"I'm . . . blessing his soul," the brother said.

The night before he was murdered, Tabatabai attended a family gathering and brought along fliers about the demonstration for his brother to distribute. a

And less than an hour before he was shot to death in his front doorway, Tabatabai was on the telephone promoting the Lafayette Square rally to Laurie Baum, a reporter for The Jewish Week, a Washington-area publication.

Repeating the anti-Khomeini criticisms he had made previously in numerous radio, television and newspaper interviews, Tabatabai likened the atmosphere in Iran today to "Hitler Germany."

He freely gave his own name but refused to reveal the name of other rally organizers, fearing reprisals on them.

"The dangers to Iranians who openly disagree with the Khomeini regime are many," he told Baum. "There are Khomeini gangsters who threaten us here but we are not afraid."