Ayatollah Ruhollah Khomeini, Iran's exiled opposition leader, today issued an indignant rejection of President Carter's appeal for cooperation with the new government in Tehran yesterday and said it is not up to the United States to decide what kind of rulers are best for his troubled country.

The Shiite Moslem leader's blunt statements, made through a spokesman at his exile headquarters near Paris, emphasized his insistence that the government of Prime Minister Shahpour Bakhtiar is illegal because it flows from the authority of the departed shah, and therefore must be swept away before tranquility can return to Iran.

The comments were relayed to journalists in Paris by Sadegh Ghotbzadeh, a close adviser of the 78-year-old ayatollah, or Moslem holy man. They indicated, or Moslem holy man. They indicated, by their sharp tone as well as their content, a strong determination to end a quarter-century of overwhelming American influence in his strategically and economically key nation.

We have declared that the Bakhtiar government is an illegal government and that it is a decision of the Iranians," Ghotbzadeh said. "It is not up to Mr. Carter. It is not for Mr. Carter or anybody on the face of the earth to deny the Iranians [the right] to collaborate with one, or with another. We want to be free and left alone to decide for ourselves, and as soon as this is understood by Americans, by Russians, Chinese, French, Germans, Africans and Asians, then at that time calm in the country and stability in the regime will follow."

As if to underscore his point, the ayatollah declared in advance that he would refuse to see an envoy dispatched by Bakhtiar from Tehran to try broaching a compromise of some kind between the hard-line religious leader and the struggling Bakhtiar government in Iran.

Khomeini's attitude -- apparently relishing the confrontation with Carter -- underscored the current of anti-American and anti-Western sentiment that has run throughout the year-long revolution in Iran, leading to Shah Mohammed Reza Pahlavi's flight into apparent exile Tuesday.

These feelings were enflamed by close identification of the United States with the shah and his efforts to preserve a one-man rule that many of his countrymen considered harsh, even brutal. Until only days before the shah's departure, the United States was insisting its Iran policy was support of the monarch.

In addition, many of the shah's reforms, introduced in the name of modernizing Iran and bringing it closer to Western standards, were seen by the conservative Shiite clergy as attacks on their traditions. With strong U.S. involvement in the modernization programs -- there were more than 40,000 U.S. advisers and workers in Iran -- these, too, often were identified with the United States.

Khomeini's own background also seems conducive to distrust of the United States. He is a devout Moslem and therefore inclined to oppose U.S. support of Israel. Moreover, most of his time since the shah drove him into exile in 1963 has been spent in Iraq, an aggressively anti-Israeli Soviet ally where "United States" and "imperialism" appear as near-synonyms in the daily press and on the national radio.

There have been reports, stemming from speeches and writings attributed to Khomeini, that the ayatollah's devotion to conservative Islam also includes a dose of anti-Semitism. But Khomeini's aides have denied he authored the anti-Semitic remarks and Ghotbzadeh told reporters in Paris that the Islamic republic would respect Iran's religious minorities, including Jews and the Bahais, followers of a syncretic religion centered in Iran. An Iranian Jewish delegation called on the ayatollah two months ago and received assurances that he feels Islam imposes an obligation to respect these religious, Ghotbzadeh said.

Khomeini's declared aim for Iran is establishment of an Islamic republic with a national parliament in which he would play a dimly defined role as a kind of guiding light. In an Interview with CBS last week, he agreed with a suggestion that he would in effect help lead the government.

Khomeini has promised to name within a few days the members of a provisional government that would clear the way for setting up his Islamic republic. He announced in Paris yesterday that he has named Jalil Zarrabi, an Iranian physician in Houston, Tex., to act as his special envoy in Washington and take care of the Iranian embassy here.

The shah's ambassador to Washington, Ardeshir Zahedi, is reported to be on the West Coast of the United States preparing for the shah's arrival there for an indefinite exile. His resignation was announced in Tehran Wednesday, but he later denied it and the embassy's allegiance remains uncertain.

Whatever the composition of the provisional government, American officials clearly seem more at home with the Western-oriented parliamentary system Bakhtiar is trying to organize in Tehran. A French-educated intellectual, Bakhtiar almost certainly would be easier to deal with than the elderly holy man whose call for a return to traditional Moslem values has driven the shah abroad and transformed Iran from a dependable U.S. ally to a potentially unfriendly unknown.