Sen. Edward M. Kennedy (D-Mass.) announced yesterday that he will not be a candidate for president in 1988, and conceded that he may never attain the office his family has been identified with for the past quarter-century.

The front-runner for the Democratic Party's nomination in all early polls, and the possessor of the most star-crossed name in contemporary American politics, Kennedy, 53, said in a statement broadcast last night on Boston television:

"I have decided that the best way to advance the values that you and I share -- peace on earth, economic growth at home, compassion to all Americans -- is to be a United States senator and not a candi- date for president of the United States . . . .

"I know that this decision means that I may never be president, but the pursuit of the presidency is not my life. Public service is."

Kennedy said he will seek reelection in 1988.

It was the fourth time in the past 13 years that Kennedy has taken himself out of consideration well in advance of a potential presidential campaign. He sought the nomination in 1980, but lost in a bitter primary challenge to President Jimmy Carter.

In years past, Kennedy cited personal reasons for taking himself out early, in particular his obligations to his own three children and those of his two slain brothers, President John F. Kennedy and Sen. Robert F. Kennedy (D-N.Y.).

This time, his decision appeared to be more political than personal. Aides said that Kennedy's three children had given their assent to a presidential race, but the senator concluded that he did not want to endure three years of having all of his votes, speeches and political movements probed and dissected for presidential motivations.

"He began noticing it after his trip to South Africa in January , and with his votes on Gramm-Rudman and the line-item veto," said William Carrick, a political aide. "There are lots of things he cares deeply about that were being treated in terms of presidential positioning. He didn't like it."

Others, however, suggested that the announcement was an accommodation to political reality. Kennedy, they said, was too closely associated with a discredited brand of Democratic liberalism and still had not found a way to overcome questions about his character that plagued his 1980 presidential race.

Robert Shrum, a former Kennedy speechwriter, said a small circle of present and past aides was summoned Wednesday afternoon by Kennedy to the family compound in Hyannis Port, Mass., to hear of Kennedy's decision and make preparations for the announcement.

"He sat us down and said he had been giving a lot of thought to 1988 and said he knew this would be a disappointment but that he decided not to run. There wasn't really any discussion. We all had the good sense not to say, 'Hey, wait a minute . . . . ' "

"Then we all went and had dinner. It was all very relaxed. He was friendly and funny."

Kennedy will embark today with his children on a cross-country trip to highlight hunger in America, a trip, Shrum said, he wanted to be able to make without being accused of presidential politicking.

The announcement triggered encomiums from Democratic leaders all over the country, not least from those whose own White House aspirations have been lifted by the news.

"I respect Sen. Kennedy's personal decision and have every confidence he will remain a leader in the Democratic Party and a national spokesman as long as he wants," said Sen. Gary Hart (D-Colo.), who is expected to announce next month he will forgo a 1986 Senate race in order to concentrate full-time on the 1988 presidential contest.

"I've said on many occasions that I thought he would be a strong candidate, but, on the other hand, no one has a right to tell a member of the Kennedy family that he has a duty to the party or to the nation," said New York Gov. Mario M. Cuomo. "Sen. Kennedy's statement . . . is an act of personal strength and political class," said Democratic National Committee Chairman Paul G. Kirk Jr., a former Kennedy aide. "There is no question he would have been a formidable candidate."

Not all party leaders agreed that he would have been strong candidate.

"Kennedy's popularity has always been in inverse proportion to how close he is to a presidential campaign," said one top Democratic strategist, dismissing early polls showing Kennedy leading the Democratic presidential field for 1988.

"I assume he has been seeing what we have all been seeing, that there is a longing for a changed party and that no matter how hard he tries to change, he is the personification of an older wing of the party," the strategist, who asked not to be identified, added.

Kennedy's votes in recent months -- especially the one this fall in support of the Gramm-Rudman-Hollings deficit-reduction measure, got a rude reception from friends and foes in the party.

" . . . A lot of his friends are waiting for an explanation of that one," John Perkins, political director of the AFL-CIO, said.

In his statement last night, Kennedy referred to the "passions on both sides" that would have been ignited if he ran for the presidency. He ran head first into those passions in 1980, when he found that many voters could not forget his automobile accident on July 19, 1969, at Chappaquiddick, Mass., in which a passenger, Mary Jo Kopechne, drowned.

That incident, Kennedy's subsequent divorce and the constant tabloid-style attention to his private life, have been sources of political difficulty for Kennedy over the past 15 years.

On the other hand, Kennedy maintains a loyal following of activists in the party, and he had been dropping hints all year he intended to run. That is why yesterday's announcement was such a shocker.