President Carter and two generations of the Kennedy family paid tribute to John F. Kennedy today, invoking the late president's words and spirit as part of their own visions of the nation's future.

Dedicating the John F. Kennedy Presidential Library, Carter and Sen. Edward M. Kennedy (D-Mass.) set aside their differences for the moment to join together at what the president called "this occasion at once so solemn and joyous."

"The first president born in this century, he embodied ideals of a generation as few public figures have ever done in the history of the earh," Carter said. "He summoned our nation out of complacency and he set it on a path of excitement and hope."

"It was all so brief," Edward Kennedy said of his brother's presidency.

"The thousand days are like an evening gone. But they are not forgotten, Those whose lives he touched will never be the same."

With the towering library, on a rugged slice of land that juts into Dorchester Bay serving as the backdrop, familiar faces of the past mingled with powerful political figures of the present. But it was a Kennedy of a young generation -- Joseph P. Kennedy III, eldest son the late Robert F. Kennedy -- who provided the dedication with its most overtly political moment.

His voice wavering at times, the 27-year-old Kennedy spoke emotionally of his father's life and struggles, delivering a stinging rebuke to the nation's most powerful economic and political forces and , without mentioning the administration, some of the policies the president strongly supports.

"We all know inflation bears down most heavily on the poor," he said. "Now we're told by the chairman of the Federal Reserve Board that we have to reduce our standard of living. But what about the standard of living of people on the boards of oil companies? Yes indeed, we need to conserve, yes by all means, but that means all of us . . . ."

Unspoken throughout the 90-minute dedication ceremony was the underlying political reality that Kennedy will almost certainly challenge the president for the Democratic presidential nomination. It gave the occasion a certain tension, broken briefly by Carter as he began an otherwise serious speech of tribute.

In 1962, Carter recalled, a questioner told President Kennedy that your brother Ted, after seeing the cares of office on you, wasn't sure he'd ever be interested in being president."

The questioner, Carter said, wanted to know whether, if he had it to do over again, President Kennedy would seek the presidency, and whether he could recommend the job to others.

Carter continued: "The president replied, 'Well, the answer to the first question is yes and to the second, no. I do not recommend it to others -- at least for awhile."

"As you can well see, President Kennedy's wit -- and also his wisdom -- is certainly as relevant today as it was then," Carter said.

Sen. Kennedy joined the crowd in laughter and applause as the coming Carter-Kennedy clash was thus glossed over lightly.

But that expected conflict remained the central political fact of the day as the president, surrounded by members of the Kennedy family in the city that nurtured the Kennedy legacy, offered a simple but eloquent tribute to one of his predecessors.

Speaking with unusual poise and feeling, Carter also used the occasion to deliver his own political message -- that the world has changed in the 20 years since the New Frontier, and that John F. Kennedy would be the first to understand that.

"President Kennedy was right: change is the law of life," he said. "the world in 1980 is as different from what it was in 1960 as the world of 1960 was from that of 1940. Our means of improving the world must also be different."

In what amounted to a defense of his policies in an era different from the one in which John Kennedy governed, the president continued:

"After a decade of high inflation and growing oil imports, our economic cup no longer overflows. Because of inflation, fiscal restraint has become a matter of simple public duty . . . We have a keener appreciation of limits now, the limits of government, limits on the use of military power abroad . . ."

Still, Carter added, while "the problems are different [and] the solutions, none of them easy also different, in this age of hard choices and scarce resources, the essence of President Kennedy's message -- the appeal for an unselfish dedication to the common good -- is more urgent than it ever was."

In his speech, Sen. Kennedy made no reference to his expected challenge to Carter, but spoke in personal terms of his brother.

"He and I had a special bond despite the 14 years between us," Kennedy said. "When I was born, he asked to be my godfather. He was the best man at my wedding. He taught me to ride a bicycle, to throw a foward pass, to sail agains the wind."

Despite the political awkwardness of the occasion, the dedication proceeded without a hitch in warm, breezy weather. The scene was rich in political ironies, including the fact that Stephen E. Smith, Kennedy's brother-in-law and soon-to-be chairman of his exploratory presidential campaign committee, is the president of the Kennedy Library Corp. and served as master of ceremonies at the dedication.

The president arrived in Boston this morning, and went immediately to the $14 million library, where he was given a private 45-minute tour of the facility by Sen. Kennedy and library officials.

Designed by architect I. M. Pei, the library at the tip of Boston's Columbia Point peninsula, consists of a nine-story, precast white concrete tower and a glass-enclosed pavillion that adjoins the tower. The complex, which was paid for mostly by private contributions, will house John F. Kennedy's presidential papers and exhibits on his life and career, as well as material on the life and career of his brother, attorney general and later senator Robert F. Kennedy.

Just before the dedication ceremony began, the Kennedy family and other dignitaries took their places on a stage facing the bay. They included Sen. Kennedy and his estranged wife, Joan; President Kennedy's widow, Jacqueline Onassis, and his children, Caroline and John F. Kennedy Jr.; Lady Bird Johnson and Ethel Kennedy. The late president's mother, Rose Kennedy, who is recovering from recent surgery, was not present.

The last to enter, with his wife, Rosalynn, the president bounded up to the stage, where he kissed Joan Kennedy and Lady Bird Johnson, as well as Onassis, who visibly recoiled from the gesture.

Sen. Kennedy appeared subdued throughout the ceremony and, if anything, embarrassed when his nephew, Joseph, delivered his denunciation of big business and other powerful economic interests in the country.