President Carter appealed yesterday for voluntary energy conservation measures to offset the loss of Iranian oil imports and warned that "strenuous action" will be necessary if the oil shortage worsens in the coming months.

During a nationally televised news conference, the president was more optimistic than some other administration officials have been, asserting that the upheaval in Iran has not produced a "crisis" and that there is "no immediate danger" to the United States from the oil shortage.

But Carter also said if Iran does not increase its oil production in the next several months -- a prospect administration officials consider remote -- then the shortage in U.S. supplies could go up sharply, from its current level of 2 1/2 percent to 6 percent or more.

In that event, he added, "we would have to take more strenuous action."

The president did not outline what steps to curb energy consumption are under consideration. However, a senior White House official, while saying that the White House doesn't consider gasoline rationing "necessary or appropriate," said the Energy Department and the National Security Council have been at work on contingency plans to deal with shortage brought on by the loss of Iranian imports.

Energy Secretary James R. Schlesinger Jr. has already outlined some of those contingency plans to members of Congress. They include oil allocations and mandatory conservation measures, including Sunday gasoline station closings, lower thermostat settings, restrictions on commuter parking and a ban on decorative gas lighting and some lighted advertising signs.

The oil shortfall in the United States because of the loss of Iranian supplies is currently about 500,000 barrels a day, compared with a shortfall of almost 1.6 million a day during the 1973-74 Arab oil embargo. But Schlesinger has warned that the Iranian shutdown is "prospectively more serious" than the embargo, a bleak prognosis based on intelligence analyses suggesting that Iran could not return to its previous production levels until December at the earliest.

Delivering a prepared statement at the beginning of his news conference, Carter was more optimistic about the chances of dealing with the shortfall. Asserting that the loss of Iranian supplies "underscores the vulnerability" of the United States to outside oil suppliers, he said:

"I want to emphasize and support the call that Secretary Schlesinger made for voluntary conservation of oil within our nation by all Americans. If we would honor the 55 mile-per-hour speed limit, set thermostats no higher than 65 degrees in homes and buildings and limit discretionary driving, voluntarily and shifting to car-pools and to rapid transit systems, we could offset the current reduction in Iranian supply of oil to our country."

The president said he is particularly concerned that some "ill-advised state legislatures" are considering raising state speed limits above 55 miles per hour. Wyoming and some other western states have threatened to take such action, risking the loss of federal highway funds.

Carter was equally optimistic on the subject of inflation, although he warned that last month's 1.3 percent rise in wholesale prices demonstrates that "we cannot shrink from making tough decisions which are needed to bring inflation under control."

The president said such a large increase in the wholesale price index is not expected to reoccur in the coming months.

"All available evidence indicates that the [wage and price] guidelines which we have established are beginning to take hold," he said. "The first major wage settlement by the Oil, Chemical and Atomic Workers and by others since then have fallen within the 7 percent guideline figure. The overwhelming majority of major corporations have pledged to comply with the voluntary guidelines and we expect the others to follow suit."

Carter called on Congress to "hold the line on federal spending" and to enact his real wage insurance and hospital cost containment proposals.

"For more than 10 years now, we have lived with rising inflation," he said. "Now the program that we have set in force is beginning to work and if we all do our part, we can succeed in reducing inflation in our country step by step."

On another domestic topic, the president, who looked unusually tired during the news conference, said that projections of a budget surplus in the early 1980s do not take into account the cost of such programs as revising the welfare system and establishing a national health insurance program. But he said if actual surpluses are available, some of the money would be used to reduce the national debt.