President Carter dealt Sen. Edward M. Kennedy a decisive setback tonight as a torrent of Democratic voters turned the Iowa caucuses into a testament of support for Carter's handling of the crises in Iran and Afghanistan.

Carter rolled up a 2-to-1 lead over his challenger in the opening contest of the 1980 presidential race and was ahead in all but one of Iowa's 99 counties.

The president, who did no personal coampaigning because of the international situation, defeated Kennedy in heavily Catholic Dubuque, in Des Moines, in Cedar Rapids and in Waterloo -- all strongholds of the pro-Kennedy United Auto Workers -- and rolled up tremendous margins in rural areas, despite controversy over his partial embargo on grain sales to the Soviet Union.

His victory margin was swelled by a turnout that party officials said was between 90,000 and 110,000 people -- more than twice the 38,500 who turned out for the 1976 caucuses.

Unlike four years ago, there were few uncommitted delegates elected tonight. This was a setback for Carter's other challenger, California Gov. Edmund G. (Jerry) Brown Jr., who ended his abortive Iowa effort by asking his backers to support uncommitted delegates.

With 96.5 percent of the precincts reporting, Carter had 59.1 percent and Kennedy 31.2 percent, with 9.6 percent of the delegates uncommitted.

Carter's Iowa landslide was worse than Kennedy had expected in the state he had called "the first real test" of his candidacy, but the senator said he would continue his challenge in the February contest in Maine and New Hamphire.

In Washington late tonight, 200 Kennedy supporters crammed into the repair bay of the former Cadillac dealership on 22nd St. NW that serves as Kennedy campaign headquarters to hear the first concession speech of the Massachusetts senator's political life.

The mood of crowd and candidate was more stiff-upper-lip than down-in-the-dumps. When Kennedy came in at 11:30 with his wife, Joan, their daughter, Kara, and a baker's dozen of hephews and nieces, he began his remarks by joking with the audience. "Well-l-l," he said with a smile, "we could have done a little better in Iowa."

Kennedy congratulated Carter "for his win," but told the cheering audience that "according to my count, President Carter needs 1,643 delegates more to win the nomination. We need 1,657 and we're going to get 'em.

Late tonight the president issued a victory statement from the White House that referred to the "international circumstances" he said had prevented him from campaigning in Iowa and confronting his Democratic challengers directly.

"I deeply appreciate the vote of confidence from Iowa Democrats," Carter said. "Their expression of support is particularly welcome in these difficult times."

After thanking his supporters and congratulating Kennedy on a "hard-fought" effort, the president said he regretted being "unable" to campaign in Iowa and looked forward "to the time when international circumstances permit me to seek actively and personally the support of my fellow Democrats."

Carter congratulated his Iowa capaign manager, Bill Romjue, in a telephone call, and said he would thank his Iowa supporters in person as soon as the international situation permitted him to resume travel.

But White House press secretary Jody Powell said in Washington that no date has been set for the resumption of the partisan activities Carter suspended when the American hostages weere seized in Tehran Nov. 4.

Powell said the intenational situation was "obviously a significant factor" in rallying Democrats behind the president, but insisted that Carter would have been better off in Iowa if he had been able to campaign personally. w

Kennedy backers claimed, however, that Carter's absence shut down the campaign dialogue -- particularly on the domestic economic issues Kennedy had wanted to emphasize -- and wrapped the president in an aura of nonpartisan authority.

Whatever the explanation, Carter's victory was a vindication both of his strategy and his national leadership.

The margin of the president's victory was big enough to cast a large cloud over Kennedy's future plans, but aides were quick to say the Massachusetts senator will continue to press the challenge.

When he announced in November, Kennedy called the Iowa caucauses "the first real test" of his candidacy.

But Joseph P. Kennedy III, the senator's nephew and Iowa compaign chairman, said tonight that, despite the severe setback here, "We will continue our efforts across this land. Maine and New Hamphire, here we come!"

At Kennedy Headquarters, Carl Wagner, one of Kennedy's key operatives, said, "it's a big night for the president," but reiterated that it would not alter Kennedy's effort in other states.

The next contests come next month in the Maine caucuses and the New Hamphire primary -- tests in Kennedy's New England home territory that the senator now cannot afford to lose.

Technically, all tonight's voting in the 2,531 precincts was to accomplish was the election of more than 7,000 delegates to the March 8 conventions that will be held in each of Iowa's 99 counties. They, in turn, will elect 3,320 delegates to the April 19 congressional district conventions and the June 14 state convention, where Iowa's 50 national convention delegates will be chosen.

But this preliminary test marked the first official step in any state toward election of 1980 convention delegates. It has acquired great symbolic importance because the Iowa caucauses of 1976 -- where Carter won 29.1 percent of the delegates, less than the uncommitted total but more than any of his five rivals -- were credited with launching him toward the White House.

This year, Carter and Kennedy both spent the maximum $481,000 allowed by law in an effort that was expected to expand the turnout at the neighborhood meetings from the 38,500 who participated in 1976 to perhaps 50,000 or 60,000 of the state's 550,000 registered Democrats.

With both candidates having fullscale organizations in the field, Tim Kraft, Carter's national campaign manager, and Tom Miller, Iowa attorney general and leader of the Kennedy campaign, agreed today that the outcome was "a fair test" of Iowa Democrats' attitudes at the moments toward the two candidates.

But Miller was quick to point out that the circumstances were far different from those prevailing last November, when Kennedy said his newly announced challenge to Carter would have its first test in Iowa. "He had no way of knowing what the Iranian and Afghanistan crises were going to do to the campaign when he said that," Miller said.

Carter cited the hostage situation in Iran as his reason for canceling out of a scheduled Des Moines television debate on Jan. 7, which both Kennedy and Brown had hoped to use to sharpen their economic, energy and foreign policy differences with the president.

While avoiding overt campaigning himself, Carter made hundreds of phone calls from the White House to Iowa supporters, flooded the state with surrogate campaigners, and, last week, dispatched more than 30 of his washington aides to assist in the roundup of voters for the caucuses.

Kennedy, starting seven months later than Carter's Iowa organizers, nevertheless threw together a precinct organization that won the admiration of veteran Iowa Democrats as one of the most impressive ever seen in the state.

Kraft said the "imponderables" in the campaign included the Iowa farmers' reaction to Carter's partial embargo on grain sales to the Soviet Union and the continuing discussion throughout the campaign of Kennedy's behavior in the Chappaquiddick drowning incident.

But overriding all those questions were the international crises in Iran and Afghanistan.

As voters went to the caucuses, the Carter campaign was running a television ad that showed a grim faced Carter seated before a world map with a menacing red-colored Soviet Union, while a narrator said: "On Monday night, Iowa will send a clear signal to the rest of the world. Do we or do we not support the president? The closing slogan was: "President Carter -- he's fighting for all of us." CAPTION: Picture, Kennedy to supporters: "We need 1,657 [delegates] and we're going to get'em." AP; Symbol, The Democrats