Sen. Edward M. Kennedy returned to the campaign trail today, accusing President Carter of seeking 'blank-check' approval of a "failed foreign policy."

In a speech at Harvard University launching a closing drive for the Feb. 26 New Hampshire primary, the Massachusetts Democrat blamed Carter for both the Iran and Afghanistan crises and said: "No president should be reelected because he happened to be standing there when his foreign policy collapsed around him."

Buoyed by the unexpectedly close run he gave Carter in Sunday's Maine Democratic town caucuses, Kennedy gibed constantly in a round on TV appearances and fund-raisers at Carter's refusal to leave the White House and campaign.

Repeatedly comparing Carter's decision to the strategy Richard Nixon used in the 1972 election, Kennedy said the president was asking for a blank check. The last time the people of this country gave out a blank check, it was to Richard Nixon. One is enough.We should have learned our lesson.

In an address on the presidency at the John F. Kennedy School of Government at his alma mater, the senator said, "The meaning of Maine is that the presidency can never be above the fray, isolated from the actions and passions of the time. A president cannot afford to posture as the high priest of patriotism . . . As we learned in 1972, a president who is not open with the people during the campaign may well conduct a closed presidency after the election."

The toughened rhetoric reflects the belief in the Kennedy camp that Carter's refusal to campaign personally -- which White House aides said will not change as long as American hostages remain in Tehran -- began to cut against the incumbent in Maine and may cut more deeply in New Hampshire.

Kennedy also stepped up his attack on Carter's foreign policy, apparently in the belief that the patriotic appeals by Carter partisans to uphold the president in his dealings with the Soviet and Iranian authorities had fallen on deaf ears in Maine.

Claiming that Carter had ignored "months of signals" about the Soviet move into Afghanistan, Kennedy said "another president would have raised the issue in advance, instead of drawing a line after it was already crossed."

"And if the administration had not parlayed the SALT treaty into nearly certain Soviet defeat," he said, "the Soviets would have had something to gain by restraining their aggression."

Had he been president, Kennedy suggested, "The crisis might have ended with nothing more than Soviet military maneuvers near the Afghan border."

The Senator repeated his earlier charge that Carter also was at fault for the hostage situation, which he described again today as the "predictable" result of the decision to admit the exiled shah of Iran to the United States for medical treatment.

Claiming that the administration had delayed the release of the hostages by first threatening and then withdrawing economic sanctions against Iran and by rejecting and then moving to accept a commission on Iranian grievances" against the shah, Kennedy said: "We are now in the 101st day of a crisis that never should have happened."

"The last gasp of a failed policy is war. And that is what this administration has brought us to believe we face in 1980."

Warning that war in the Persian Gulf would mean "a nightly television body count of America's children," Kennedy again assailed Carter's proposal for resumption of draft registration -- a line that brought cheers from the Harvard students.

Kennedy is to appear Wednesday at the University of New Hampshire in a continuation of the campus drive that his aides hope will produce hundreds of volunteer student canvassers for the closing days of the New Hampshire primary.