Because of a typographical error, The Washington Post quoted Sen. Edward M. Kennedy (D-Mass.) yesterday as saying that the United States tells "Hispanics who are here illegally that they have to wait nine years to bring their wife and children to this country." The senator's reference was to "Hispanics who are here legally."

Democratic presidential candidate Edward M. Kennedy unleashed a harsh attack on the shah of Iran last night and spent today trying to dig himself out from under a bipartisan barrage of criticism that he was damaging President Carter's efforts to save the American hostages in Tehran.

The Massachusetts senator told a San Francisco television interviewer Sunday night that the shah "ran one of the most violent regimes in the history of mankind" and stole "umpteen billions" from his nation. He said the United States should build its friendship with "the Iranian people" rather than with "a dictatorship."

Without withdrawing his criticism of the deposed Iranian monarch, Kennedy said today in an impromptu news conference and a formal statement that the issue of the shah's past conduct was "completely distinct" from the release of the 50 Americans seized at the embassy in Tehran last month and did not weaken his support of Carter's efforts to free the hostages.

But his earlier comments drew sharp criticism in Washington from the State Department, the chairmen of both political parties, several Republican presidential hopefuls and the head of Carter's reelection committee.

"I think it's an error to inject anything into this campaign that could endanger the lives of the people over there," Robert S. Strauss, Carter's campaign chairman, told a crowded news conference. "Frankly, I think it is damaging to Senator Kennedy's campaign."

As the first major controversy of the Kennedy-Carter campaign rattled from coast to coast, the senator and his supporters tried to damp down the conflict.

Kennedy had said regularly in the past two weeks that it would be unwise to talk about the Iran's past or future while a mob holds American hostages. He has dodged questions about the shah, saying Americans "must speak with one voice" on Iran until the crisis is resolved.

In a TV interview Sunday morning in Los Angeles, Kennedy was asked whether the Iranians have a legitimate grievance against the shah. He replied: "I don't think looking to the past or anticipating the future enhances the opportunity for the safety and security of those hostages."

But 12 hours later, in an interview with KRON-TV in San Francisco, Kennedy was asked whether it would amount to betrayal of an old ally if the shah were pressured to leave the United States.

"Because the shah had the reins of powers," he answered, "and ran one of the most violent regimes in the history of mankind, in the form of terrorism and the basic and fundamental violation of human rights in the cruel circumstances to his own people, how do we justify in the United States, on the one hand accepting that individual because he would like to come here and stay here with his umpteen billions of dollars that he's stolen from Iran and at the same time say to Hispanics who are here illegally that they have to wait nine years to bring their wife and their children to this country?"

When the interviewer mentioned the shah's longtime support for America, Kennedy replied: "I think he was looking out for one person -- himself."

The "students" who seized the U.S. Embassy in Tehran, and Iranian leader Ayatollah Ruhollah Khomeini have insisted that the hostages will not be released until the shah is returned to Iran to face charges of brutality and theft.

When reporters traveling with Kennedy asked him at an impromptu news conference today at San Francisco airport what had prompted him to level such charges against the shah, he replied: "I was asked about it." Noting that he had criticized Iran for human rights violations while the shah was in power, he said, "It would be contradictory for me to change what I said about the shah for years."

Kennedy's concern over the political controversy stirred by his television remarks was underlined when he issued a formal statement of explanation on arrival here, adding his rejection of the possibility that the shah be granted permanent political asylum in this country.

At the San Francisco airport he said testily, "Because we condemn the actions of the Iranian government in holding the hostages doesn't mean that we have to accept everything the shah represented over a period of years." t

At the White House, the official posture was that Carter was too preoccupied with the continuing crisis in Tehran to take notice of Kennedy's words.

"The president made it clear last Wednesday night," said White House press secretary Jody Powell, "that he did not think it appropriate . . . to allow himself to be drawn into political debate on this matter while our people are being held in Tehran."

But Powell added, "I think you can recognize how bloody my tongue is from being bitten."

There was no shortage of comment from Carter's administration and political lieutenants. State Department spokesman Hodding Carter said, "The secretary of state regrets any such statement which shifts the focus away from concern for the hostages and may interfere with delicate negotiations."

For the Carter campaign, Strauss said Kennedy's comments were "poorly advised."

"He's obviously troubled by what he said," Strauss said in a reference to Kennedy's attempts at clarification, "and he ought to be.

"Those who advise Senator Kennedy misread the firmness of the people of the country to stand behind the president."

[At a later campaign stop in Bismarck, N.D.,Kennedy curtly brushed aside Strauss' criticism.

"I am glad to state my policy position," the weary candidate said, "But I don't feel that I have to respond to anything Mr. Strauss has to say, quite frankly, and I don't intend to, quite frankly."]

Democratic National Chairman John C. White said he thought that the Iranian leaders who "have been trying to divide this country. . .certainly will welcome support for their position."

Many Republicans also seized the opportunity to jump on Kennedy. GOP National Chairman Bill Brock called the comments "careless and irresponsible."

Republican presidential hopeful John B. Connaly said in Birmingham, Ala., that he was "sure the Ayatollah Khomeini is pleased to hear Senator Kennedy's remarks." Another Republican contender, George Bush, said that for Kennedy "to make such statements during such a highly charged emotional period. . . raises serious questions as to his judgement on foreign policy. . . . It is irresponsible for him to echo charges of Ayatollah Khomeini and his fanatics."

Sen. Bob Dole of Kansas, a third Republican challenger, said, "I fear that Senator Kennedy, wittingly or unwittingly, may be providing ammunition for the propagandists of the ayatolish."