The Ayatollah Ruhollah Khomeini, the Moslem holy man who leads the Iranian opposition movement from exile, called on the Iranian armed forces yesterday to turn against the shah and "join the people" against "the traitor."

Khomeini said in an interview that he saw no possibility of compromise with Shah Mohammad Reza Pahlavi, and he expressed great bitterness toward the U.S. government over its efforts to keep the shah in power.

The ayatollah dismissed the shah's appointment yesterday of a military government to deal with the rioting and demonstrations in Iran as representing no change.

"Until the day an Islamic republic is installed in Iran, the struggle of our people will continue," he said, adding that it did not matter to the anti-shah forces whether there was a military or civilian government.

The Moslem leader added that "at least 45,000" American military advisers have the Iranian Army "totally under their control." The United States, he said, is working "to maintain this regime" by "any measures."

As long as the United States remains "hostile to our Islamic movement," Khomeini said, "our attitude toward the United States will be negative."

He said that there could only be improvement in relations between Washington and an Iranian Islamic republic if the United States ends what he called its economic domination of Iran.

"The relationship between the American government and our government that is now like of a master and a servant should finally cease and a healthy relationship would then replace it," the ayatollah said. Washington supports the shah, he said, "obviously to serve its own interest."

The religious leader and his aides alluded often to his vision of a socialist Islamic republic in which various political parties would be allowed to function. Khomeini said Iran under such a government would continue to export oil and natural gas to both Western and socialist countries. He said he did not intend to take a leadership role in a new government,

Khomeini said he would prefer that the army oust the shah over having to call on his followers to take up arms and risk massive bloodshed.

But he also stressed that he reserves the right to call for armed rebellion later.

"It is the absolute right of people to fight against this regime with whatever means they choose," he said. At another point he noted that if the shah cannot be deposed peacefully, "We may have to reconsider our decision" against taking up arms.

"We hope," he said, "that the armed forces will see that this movement is for the betterment of our brothers and sisters and that the shah is a traitor who has betrayed the nation. We hope they will finish this crisis at that time."

"There are signs even now," Khomeini said, "that there are some difficulties in the army."

One of his aides said Iranian soldiers had disobeyed their commanders' orders to arrest demonstration leaders at the houses of two other religious leaders recently released from prison. The men the troops were ordered to arrest were reading aloud an appeal by Khomeini to the armed forces.

Khomeini, 78, was interviewed in a modest suburban house outside Paris furnished only with persian rugs.

Following ground rules he has established for his dealings with the press, he first answered a number of questions submitted in writing. Later in the day he allowed about 15 minutes for followup questions and answers.

Asked if an Iranian Islamic republic would continue to sell oil to the West and natural gas to the Soviet Union. Khomeini said he would not be interested in cutting off economic relations with the rest of the world but that he wants "to prevent the plunder of our natural resources."

Khomeini, who has lived in exile in Iraq for most of the past 15 years, dismissed the idea that the Shah has tried to transform Iran into a modern industrial society.

"The Shah," he said, "has destroued the economy and the industry and the agriculture. You call this modernization and transformation to an industrial society. Our objective is to start a real modernization based upon the fundamental needs to the vast majority of the people who are poor."

He said a new government would continue to export oil and gas.

"What is more important is that the revenue form the sale of these natural resouces will be allocated to economic development, and we will have broad relations with industrialized nations. But the right to decide on the direction in which our economy will go will be ours, and we will be the ones to decide upon it."

"We won't eat the oil, we've got to sell it," said Khomeini's aides. He cited as an example of the exploitation of Iran by outsiders the Shah's deal to sell natural gas to the Soviet Union for $2 a cubic meter. The Soviets repipe it to Europe for sale at $16 a cubic meter, the aide said.

He took the view that the Soviets also oppose the ayatollah because they fear that an Islamic republic in Iran would be too strong a magnet for the millions of Moslems in Soviet Central Asia.

Khomeini's Western-educated aides, who serve as his interpreters from Persian, insist that he is far more enlightened and realistic about the organization of Iranian society that he is depicted in the shah's propaganda. They say many Iranian students in Western univeristies have abandoned ties with Marxist groups to follow the ayatollah's updated, social-oriented Islam. The aides say he rejects the authoritarian models of Islamic republicanism in much of the Arab world. Iran is not an Arab country.

The aide quoted Khomeini as saying, "In the history of Islam, those who denied God were free to express themselves." This, said the aide, is Khomeini's way of saying all political parties would be legal in his vision of an Islamic republic to be established in a national referendum.

An Islamic republics "objective before anything else," Khomeini said, "is to eliminate poverty and humiliation and to elevate living conditions for the great majority of our people who have just been subjected to injustice from all sides."

Khomeini is the spiritual leader of the Shiites, a sect of Moslems that encompasses more than 90 percent of Iran's 34-million people. They have traditionally been consigned to the lower classes in much of the rest of the Islamic world.

Reforms to replace the alleged false reforms of the shah, he said, should be based on "Islamic criteria." He did not define those except to say that the reforms are "possible only with the total participation of all the population."

The ayatollah is also said to consider that Moslem holy men should be allowed to run government agencies only if they equip themselves with technical qualifications few of them possess.

Yet, he is said to distrust many of the leaders of the political opposition as men who try to use his prestige to further their own ambitions.

Khomeini is said to be particularly annoyed over a communique issued yesterday by Karim Sanjabi, the leader of the leftist National Front. Sanjabi said that it was issued at the Ayatollah's house here, implying that the two men had agreed to join forces after Sanjabi paid the second brief visit in a week to the religious leader.

Khomeini's aides said their leader is making no deals or alliances with anyone and that none of the small opposition parties have any significant following in Iran. Khomeini would not answer a question submitted to him about his relations with other opposition forces. His aides said he would prefer not to go on the record publicly dismissing them.

In contrast to his black turban, Khomeini's pale face looked drawn after a long day of talking with journalists and other visitors and praying outdoors in the cool November air. The little finger of his left hand shook incontraollably as he sat on the floor of the small unheated summer house that has been loaned to him.

He spoke as if the establishment of an Islamic republic is a foregone conclusion.

Asked about is own future, he said that after the Islamic republic is set up, "I will guide the people and let them choose the sort of government they want by universal suffrage. I don't have any intention to head this government or be part of it."

That he said, was the last question. He left the house for evening prayers with his followers on a plastic sheet spread out on the damp ground of the front yard of another working-class suburban house across the street. French police stopped cars for blocks in both directions until he was safely back across the dark street.