Although dismayed by the aborted rescue mission in Iran, Japanese leaders said today it will not affect their plans to impose the sanctions they agreed on two days ago.

Prime Minister Masayoshi Ohira and other government officials, after serveral hours of doubts, said today they regarded the episode as a humanitarian rescue attempt and not a hostile action against Iran.

Ohira, at a news conference, said he was surprised by the operation but explained it was something he could understnad "sentimentally."

He restated his intent to urge President Carter to exercise restraint and avoid military actions when the two leaders meet next week in Washington.

Privately, government officials had expressed alarm at reports of the mission and said they were particularly surprised at its timing, coming a few days after Japan and the European Economic Community nations had agreed to impose some diplomatic and economic sanctions.

In the first hours after the news broke in Tokyo Friday afternoon, they said the first instinct was to believe the United States was resorting to a full-scale military action and ignoring Japanese and European pleas for restraint.

"It was an unpredictable kind of action and the Japanese do not like unpredicatable actions," said one official.

Later, however, the Foreign Ministry issued a statement saying it recognized the American "agony" over the long holding of the hostages and officially described the rescue mission as taken from "the humanitarian point of view."

It said the government will expect Carter to abide by his pledge Friday morning to seek a solution to peaceful and diplomatic ways.

Officials said privately that there is now no thought being given to relaxing the package of sanctions adopted Thursday at a Cabinet meeting.

That package did not go as far as the one the European nations agreed to earlier this week. Notably, it avoided any direct threat of a total trade boycott by mid-May if there is no progress in releasing the hostages.

The government said it would withdraw "several" of its diplomats from Tehran one at a time but did not call for a reduction in the four-member Iranian Embassy staff in Tokyo.

The government is encouraging Japanese companies to refrain from making new trade contracts with Iran but has not imposed specific limits.

Even those modest actions are not popular in the business community and the government has justified taking them on grounds it gives Japan the right to demand restraint from the United States.

Some prominent Japanese were openly critical of the attempted rescue raid. Toshio Kimura, former foreign minister, described the incident as "hasty" and in the first hours after the news broke the current foreign minister, Saburo Okita, called it "regrettable."

Michita Sakata, an influential member of parliament and chairman of a new national security committee in the lower house, cautioned that the failed mission "might push Iran to take unfavorable actions."

The affair added fuel to the opposition parties' complaints that the government's policy toward Iran has been too subservient to American interests.