President Carter yesterday indefinitely halted U.S. purchases of Iranian oil to emphasize that the United States will not allow its dependence on imported oil to influence efforts to free the American hostages in Tehran.

"No one should underestimate the resolve of the American government and the American people in this matter," Carter warned in announcing the cutoff of the 700,000 barrels a day -- almost 10 percent of U.S. imports -- that the United States has been buying from Iran in recent months.

"It is necessary to eliminate any suggestion that economic pressures can weaken our stand on basic issues of principle," the president said. "Our position must be clear. I am ordering that we discontinue purchasing of any oil from Iran for delivery to this country."

Administration aides said that Carter's action by itself would not produce gasoline or other fuel shortages, in part because Iranian oil could be replaced by oil from other countries. But Carter said, nevertheless, that the new emergency in Iran demonstrates the "extreme importance" of reducing energy use. He added:

"I urge every American citizen and every American business to redouble efforts to curtail the use of petroleum products. This action will pose a real challenge to our country. It will be a test of our strength and of our determination."

The president had hardly finished his brief, nationally televised announcement when word came from Tehran that Iran's government had decided to institute an oil boycott against the United States. In fact, the Iranians, in announcing their move, pointedly insisted they had made their decision before learning of Carter's order to stop buying Iranian oil.

Carter administration officials reacted by saying the U.S. decision had not been taken in anticipation of an Iranian boycott and said they didn't want to get into arguments about who had acted first.

Still, this latest sequence of moves and countermoves suggested the possibility of an unpredictable new escalation of the crisis triggered on Nov. p4 when militant Iranian students stormed the U.S. Embassy compound in Tehran and took 60 to 65 Americans prisoner.

As the price of the hostages' release, the Iranians are demanding that deposed Shah Mohammad Reza Pahlavi, who is undergoing cancer treatment in New York, be returned to Iran to stand trial as a criminal. The United States has rejected that demand and insisted that the hostages be freed.

Senior administration officials, who elaborated on Carter's announcement yesterday, said the U.S. move was not meant as economic retaliation against Iran. The sole purpose, they said repeatedly, was to underscore that the United States will not allow its oil needs or any other economic factor to be used as a bargaining chip by Iran in the tug of war over the hostages.

These senior officials, who declined to be identified, noted that Iran had signaled its intention to cut back its oil production and therefore should not be hurt economically by the loss of American sales. Even if Iran continues to pump oil at its present rate, the officials said, it should have no difficulty in finding buyers elsewhere for the oil previously purchased by this country.

"It is merely an act of self-discipline on our part," one of the officials said. "Our overriding concern is to secure the safe release of the hostages, and this action is intended to eliminate any perception that we would allow economic considerations to affect that priority concern."

The officials conceded that all efforts to find an effective channel for breaking through the political chaos in Iran and appealing to that country's de facto ruler, the Ayatollah Ruhollah Khomeini, so far have proved fruitless. And they admitted that they have no immediate way of telling whether the latest U.S. move will have any impact on easing the hostages' plight.

However, Carter, facing a rising nationwide tide of frustration and outrage over the situation, has been under almost unbearable pressure to take some kind of action.

For that reason, his move yesterday was seen as an attempt to put on a symbolic display of resolve behind which the American public can rally with a show of determination and sacrifice. At the same time, there obviously is hope within the administration that yesterday's move will deflect demands for military intervention or other drastic steps that could make the danger to the hostages more acute.

That point was implicit in Carter's appeal for the American people to show their solidarity with the administration's efforts to free the hostages by cutting down on U.S. oil consumption. He ended his message by saying:

"America does face a difficult task and a test. Our response will measure our character and our courage. I know that we Americans shall not fail."

The senior officials, who elaborated on his remarks, tried to reinforce the president's plea by stressing that the public, through only minimal adjustments and sacrifice, could weather the situation without creating a new profusion of gasoline lines, higher petroleum prices and damage to the U.S. economy.

Again and again, the officials argued that if all the automobiles in the country are driven three miles less a day, the savings in consumption would compensate for the loss in oil imported from Iran.

Stressing that consumer restraint was the key to making the plan work, the officials said no arrangements had been made to increase U.S. oil purchases from other sources. They conceded that some disruptions will occur in the normal patterns of oil and gasoline distribution, but said that the administration, through its allocation authority, would ensure that no region of the country will have to endure unusual shortages or hardship during the coming winter.

Although the officials did not say so explicitly, there also is the possibility that the major multinational oil companies can help to ease shortages and disruptions by shifts in the patterns of deliveries from various oil-exporting countries to their usual destinations. Such wide-scale juggling of traditional supplier-customer patterns occurred in 1973 and 1974 when the Arab oil states instituted an embargo against the United States and some European countries.

The officials said the cutoff of purchases from Iran had been under consideration for several days and that soundings had been taken among key members of Congress, other political and business leaders and the major U.S. moil companies to ascertain their attitudes. The response from those consulted, the officials added, had been strongly "positive and supportive."

That careful preparing of the gound appeared to be paying off last night in a wave of approving reaction to the president's decision. The reaction covered a spectrum ranging from political rivals seeking to capture the presidency from Carter in next year's election through business and labor leaders to consumer groups, and all of it supported the president strongly.

"I'd basically follow the president's lead on this particular step," said Sen. Edward M. Kennedy (D-Mass.) while campaigning in Iowa.

Former Texas governor John B. Connally, campaigning for the Republican presidential nomination, said, "This removes oil as a bargaining chip in delicate hostage negotiations and I fully support President Carter's action."

"He's dead right," added another GOP presidential contender, Senate Minority Leader Howard H. Baker Jr. (R.-Tenn.).

In New York, the president's announcement was cheered by hundreds of oil company executives who listened to it at an industry trade association meeting. And organized labor also supported the move in the form of a statement by outgoing AFL-CIO President George Meany, who said, "President Carter has acted wisely and well. The U.S. cannot and must not allow itself to be blackmailed any longer."

However, amid the general praise for Carter's decision there were examples of the divisions that still exist in the United States over energy policy.

The Consumer Energy Council of America, for example, said that "it is imperative than any action to shut off imports be coupled with the immediate reimposition of price and allocation controls on domestic crude oil and heating oil."

But Sen. Bob Dole (R-Kan.), another Republican presidential hopeful, reflected the sentiment of the oil industry when he declared that "the Iranian crisis once again underlines the need for increased domestic production of oil, gas and coal."

Carter is scheduled to travel today to Philadelphia for a "town meeting" and a Democratic Party fund-raising dinner in Harrisburg tonight. However, there was strong speculation yesterday that the trip will be canceled unless there is some unexpectedly dramatic change in the situation in Iran.