In a new escalation of the rhetoric between the United States and Iran, President Carter warned the Iranian government yesterday that it would face "extremely grave" consequences if a single one of the 49 American hostages at the U.S. Embassy in Tehran is harmed.

Carter's statement, which came after the president met with his top advisers at Camp David, was released by White House press secretary Jody Powell. It said:

"The president has asked that I tell you that, in his view, the last American hostage is just as important tothe United States as the first. The consequences of harm to any single hostage will be extremely grave."

Carter's words were in response to remarks made Thursday by Iran's revolutionary leader, Ayatollah Ruhollah Khomeini, who threatened death to the hostages if the United States attacks Iran and called on the Moslem world to rise up against the West.

An increasingly militant tone has been evident in statements by the two countries since Sunday when Khomeini, in interviews with American television networks, threatened to try the hostages as spies.

Since then, the United States has raised the possibility of resorting to military action, Khomeini has tried to fan anti-American sentiment in Moslem countries by seeking to implicate the United States in the seizure of a holy mosque in Mecca, and U.S. officials have responded by accusing him of lying and irresponsibility.

Each of these moves and countermoves has been carried out in ways that seemed intended for maximum exposure and impact on world opinion.

For example, the White House took the unusual step of alerting the TV networks at 5 a.m. yesterday to rush camera crews to Camp David to record the opening of Carter's meeting with military and diplomatic advisors -- a meeting that included Gen. David C. Jones, chairman of the Joint Cheifs of Staff.

Later, Powell pointedly revealed that Carter will meet with the joint chiefs and Defense Secretary Harold Brown at Camp David today. Although the meeting is supposed to focus on the defense budget, Powell refused to rule out the possiblity that the Iranian crisis will be discussed.

In still another get-tough gesture yesterday, the Defense Department announced if is canceling all flight training for the approximently 260 Iranian military personnel receiving instruction at various Air Force and Navy bases around the country.

On the Iranian side of the tug of was over the hostages that began Nov. 4, acting foreign ministry chief Abol Hassan Bani-Sadr said Iran would refuse to pay the approximently $15 billion owed to foreign banks by recently nationalized Iranian banks.

On the surface, these events, with their attendant tone of rising shrillness, suggested that both the United States and Iran are hardening their positions in ways that will make it increasingly difficult to find a peaceful resolution of the impasse over the hostages.

In fact, however, the events that have dominated world headlines this past week -- what some diplomats privately call "a duel of rhetorical artillery barrages" -- are only the most visible part of a multilayered effort to solve the crisis through what the United States, at least, hopes will be peaceful diplomatic means.

The United States has pursued a policy throughout of firmly rejecting Iran's basic demand -- the forced return of deposed Shah Mohammad Reza Pahlvai, who is undergoing cancer and gallstone treatment in New York -- and of keeping Iran isolated in world opinion by focusing attention on the plight of the hostages.

To make this strategy work, the administration has felt compelled to make a series of progressively tougher showings to keep underscoring U.S. determination not to give in to what it regards as unacceptable demands.

On the other side, the Iranian moves of recent days are seen as an attempt to bread the diplomatic isolation in which Iran finds itself by trying to shift attention from the hostages to its grievances.

That desire is regarded as the motivation for such recent maneuvers by Khomeini as using TV interviews to appeal directly to the American public and seizing on the coincidence of the mosque takeover in Mecca to gain Moslem world support and fan the anti-American impulses evidenced in rioting in Pakistan and elsewhere.

Diplomats dealing with the situation are cautiously hopeful that this cycle of mutual public flailing might now be nearing an end and that a closer focus on a diplomatic way out might soon become possible.

However, diplomatic sources also caution that a breakthrough does not seem likely for at least another week or two, largely because of timing problems created by the religious and political climate in Iran.

During the coming week, the Moslem holy period of Moharram, a time traditionally marked by mass exuberance and even violence, will still be in full swing; in addition, a national referendum on Khomeini's authority is scheduled for Dec. 2.Until these events are out of the way, the sources said, Khomeini, whose support is based in Iran's religious masses, would probably find it difficult to make any conciliatory moves that might be seen as bowing to U.S. pressure.

Another key timing factor involves the shah, who is completing his treatment and is tentatively expected to leave the United States within the next week or two. In the U.S. view, his departure would undermine Iran's rationale for holding the American hostages and make it possible to focus on some other way of redressing Iranian grievances.

In some diplomatic circles, there is a growing impression that what Iran really wants is some form of worldwide acknowledgement that the Iranian people suffered under the shah's autocratic rule for three decades.

The Iranians, according to this view, are seeking a way out that follows the traditional means of settling blood feuds in Islamic societies: admission by one party that a wrong has been committed, the setting of compensation for the injured party and, finally, the victim's refusal of the compensation, as a gesture of forgiveness.

Translated into international diplomacy, this pattern has given rise to considerable behind-the-scenes discussion of a deal that would see the hostages released in exchange for giving Iran a United Nations forum to air its complaints against the shah and the United States, and some kind of investigation under international auspices of the shah's alleged crimes.

This last point, the idea of an international investigation, is known to pose possible conflicts with U.S. law. However, Rep. George Hansen (R-Idaho), who is in Tehran on a peace mission undertaken at his own initiative, has suggested that this might be resolved by a congressional probe of the Shah's activities.

Hansen caught the administration by surprise with his one-man mission. In response to questions yesterday about Hansen's activities, State Department spokesman Hodding Carter said he was acting on his own, and reiterated the administration's policy of discouraging involvement by unauthorized mediators because of the possible confusion it could cause as the United States strives to speak to Iranian authorities in a clear and unmistakable manner.