President Carter limped across the finish line the winner on the last primary day of the year today, gaining the delegates he needs to win the Democratic nomination, but losing enough states to encourage challenger Edward M. Kennedy to try to reverse the verdict at the Democratic convention.

Incomplete returns and network projections showed Carter the winner in Ohio, West Virginia and Montana, but he was beaten decisively by Kennedy in New Jersey and Rhode Island, lost tight races in South Dakota and New Mexico and was losing in California.

Carter claimed "a wondrous victory" at an impromptu rally in Washington and invited Kennedy to iron out their differences in preparation for the fall campaign. At the same time, he said he had "no doubt" he would "triumph in November and return a Democrat to the White House." [Details on Page A15.]

But Kennedy, responding to the day's results in a brief, defiant speech in Washington, refused to concede.

"Tonight is the first night of the rest of the campaign," Kennedy shouted to a chanting, cheering corps of supporters.

"Today, Democrats from coast to coast were unwilling to concede the nomination to Jimmy Carter, and neither am I," he said. "We have carried the states that are the heartland of the Democratic Party -- New York, Connecticut, Pennsylvania, Michigan, California and New Jersey -- these states that a Democratic nominee must carry to win in November."

Kennedy said he was "committed to continue in this campaign."

United Press International said tonight that Carter had now won 1,959 delegates to Kennedy's 1,170. The count includes projections from caucus states that have not concluded their selection process. It takes 1,666 delegates to win the Democratic nomination.

While there was no real dispute over the numbers, there was great difference between the Carter and the Kennedy camps on the finality of the verdict.

Robert S. Strauss, Carter's campaign chairman, told reporters here, "It's over. We'll have a minimum of 600 more delegates than Kennedy, and we're thinking about the fall campaign."

But Richard C. Drayne, a spokesman for the Kennedy campaign, insisted that "Carter is claiming victory on the basis of a projection, and we think that projection will change" in the 10 weeks before the roll is called in New York City's Madison Square Garden.

While most neutral observers discount the possibility of a delegate revolt denying Carter the nomination, Kennedy and his aides continued tonight to speculate about ways to force "an open convention."

At the miniumum, their focus on a potential convention fight promised to impede the efforts from the Carter camp to ease Kennedy out of the race with promises of concessions or compromises on the party platform.

Even in his moment of victory, there were abundant warning signs that Carter faces a tough fight in the general election campaign. ABC News said its poll of Ohio voters showed Carter trails prospective Republican nominee Ronald Reagan by 37 to 34 percent, with 20 percent favoring independent candidate John B. Anderson.

In California, the ABC News "exit poll" said Carter was running third in a general-election trial heat, with Reagan at 49 percent, Anderson 23, and Carter 20.

ABC News said only 50 percent of today's Democratic voters in Ohio and only 34 percent of today's Democratic voters in California now plan to vote for Carter in the general election. NBC News reported two of every five Democratic voters in California, Ohio and New Jersey said they wished they had a choice today other than Carter or Kennedy.

Drayne, noting these weaknesses, called Carter "a sure loser" in November.

But Strauss brushed aside the continuing barbs and extended an olive branch to Kennedy.

Congratulating the Massachusetts senator on his campaign, Strauss said the Carter forces recognized that he had a constituency "that deserves to be represented" in drafting the Democratic platform and setting the party's course for the future.

"It's [the constituency] just not big enough to get him nominated," Strauss said.

Asked what he thought Kennedy should do, Strauss said, "I'm sure that when he's had a few days rest and has had time to stop and think, he'll make a good decision. I hope he makes his decision fairly soon. The quicker he says, 'Let's put it together for the fall,' the better it will be, not just for the president, but for candidates for the Senate and House as well."

Today's contest brought to an end a season of 31 Democratic primaries that began Feb. 26 in New Hampshire -- the largest number of primaries in the party's history.

But the outcome of the Carter-Kennedy test had been determined weeks ago and needed only to be ratified by today's results.

Carter had won 18 of the contests and Kennedy only five -- Massachusetts, Connecticut, New York, Pennsylvania and the District of Columbia -- coming into today's final round.

In retrospect, the first primary in New Hampshire was almost the last, as far as Kennedy's hopes were concerned. The Massachusetts senator had jumped into the race last November, at a time when Carter's poll ratings were brushing historic lows and Kennedy was rated a strong favorite to supplant him as the Democratic nominee.

But the president's handling of the Iranian hostage crisis -- which began three days before Kennedy's Nov. 7 announcement -- began the restoration of his leadership, reputation and, equally important, provided the rationale for his avoiding the risks of personal campaigning.

Carter's absence focused press and public attention on Kennedy's performance as a campaigner, which in the early weeks of his effort was spotty at best and dismal on occasions. Reactions to his personality by voters who said they were troubled by the "Chappaquiddick issue" and other aspects of Kennedy's personal history soon came to dominate the news and were never really erased.

By the time of the Iowa caucuses on Jan. 21 -- designated by Kennedy as the first real test of his candidacy -- it was clear that Carter's early starting organization and skillful exploitation of incumbency advantages would be enough to defeat a challenger whose essential message was an ill-defined promise of "leadership."

Carter defeated Kennedy by a 59 percent to 31 percent in Iowa. In reaction, Kennedy put a clearer ideological base under his candidacy, using a Jan. 28 speech at Georgetown University to identify himself with a set of liberal Democratic economic policies at odds with those of the administration. l

His showing improved in the Feb. 10 Maine caucuses, but on Feb. 26, in the leadoff primary in New Hampshire, Carter defeated Kennedy by a 10-point margin, 47 to 37.

That showing enabled the president's backers to brush off Kennedy's first victory, on March 4, in his native Massachusetts, and on March 18, Kennedy's hopes suffered what was seen accurately at the time as a staggering setback, when Carter won the first major industrial-state battle in neutral territory by an overwhelming 65 to 30 percent in Illinois.

Kennedy came back with a double upset over Carter on March 25 in New York and Connecticut, but Carter rallied the following week in Wisconsin. On April 22, Kennedy eked out a narrow victory in Pennsylvania, but by then Carter was rolling up regular victories in Southern and Western states that enabled him to withstand the partial success of Kennedy's "industrial-state strategy."

As the weeks passed, Kennedy continued to challenge Carter unavailingly to a face-to-face debate, and some of his backers threatened an effort on the convention floor to release delegates from their commitments and nominate Kennedy or someone else to carry the Democratic banner.

But insulated by his incumbency and his delegate lead, Carter was able to brush off these threats and challenges as a minor irritant. He heads into the general election after only one day of active campaigning -- a tour of Ohio last Thursday.