As his fame has spread and his collection of admiring press clippings has grown, Republican presidential candidate John B. Anderson in the process has lost a lot of the appeal that separated him from the pack in the first place.

By contrast, Edward M. Kennedy, as he blundered and tripped through a series of defeats compounded by bad luck, has begun to seem almost noble in his stoic persistence in seeking the Democratic nomination.

These changes, as observed sporadically on the campaign trail, illustrate the fickleness of the process and the tricky, sometimes treacherous workings of the chemistry between the candidates and the people. It is what California Gov. Edmund G. (Jerry) Brown Jr. might call the existential edge of the presidential race.

The business of holding oneself out as a candidate for president is bound to affect any sane person.

Moreover, there is in the character of the American electorate something devious that resembles a curious, mischievous child toying with a small animal or a fragile bug. At least so it seems this year.

Because of the unexpected arcs and tumbles their campaigns have taken, Kennedy and Anderson have provided most of the chills and thrills of the political year.

On the issues, the two have competed for some of the same support -- independents, anti-Carter Democrats, students, liberals.

Anderson, the cerebral candidate, cool and intellectual under his snow-white hair, accumulated the ego-boosting campus turnouts, and the favorable columns and editorial endorsements that paper the walls of his state campaign headquarters.

Kennedy, a candidate of the passions in the old, rabble-rousing political sense, stumped through the yawns of campus crowds who saw him as just another old Irish pol. He endured the accusations and questions about his personal life and Chappaquiddick, the student in the frogman suit, the scorn and pity of commentators, and boos on St. Patrick's Day.

Most of the humor surrounding Anderson's campaign was supplied by its whimsical, underdog character, popularized by the Doonesbury comic strip, comedian Mark Russell ("He's got $37 in his campaign chest, that's why John Anderson is cleaner that the rest . . .") and television exposure on "Saturday Night Live."

The cliche about Anderson was that he was "the best candidate in the race but doesn't stand a chance of winning."

Then he began to have what might be called upset losses -- losses by less than expected in several states. He became a contender, though never a winner.

Not long before the March 18 Illinois primary, Anderson shot up in the polls, added Secret Service protection and a horde of journalists and TV cameras to his entourage. His campaign started raking in dough.

After a bruising televised confrontation with Ronald Reagan and other Republican candidates over party loyalty, Anderson failed to win his home state. His pumpkin campaign not only failed to turn into a carriage, it began to lose its identity in a flurry of trappings.

Mixed in with the praise for candor and daring, words such as "strident" and "arrogant" began cropping up in news columns and conversation among reporters and supporters who had been following "the Anderson difference."

His Daniel-in-the-lion's-den confrontations with various special-interest groups began to seem less courageous and more mere technique.

Following an unusually soporific Anderson speech to hometown Republicans in Rockford, Ill., a few weeks ago, the subject of which was how he would run the presidency, one veteran political observer in the crowd scribbled a note to a fellow listener: "And on the seventh day, He will rest."

At a rally at Lawrence College in Appleton, Wis., Anderson got a standing ovation typical of his enthusiastic welcomes by university crowds. After his talk, the students were less demonstrative.

It was mostly an antidraft message dealing with military preparedness. At one point, Anderson wondered whether Reagan "has succumbed to that Schopenhauerish vision of the future, that it is wrong to take risks for peace . . . ."

Except for Andersonesque flourishes such as that reference to the German philosopher Arthur Schopenhauer, the speech sounded much like a stump harangue by an "establishment" politician.

Anderson rarely falters in his crisp, energetic diction and seemingly effortless flow of expression. But he did at one point that evening, when a student asked how he was going to appeal to voters of "low education" as well as to the educated elite crowds from which he has drawn much of his support.

Anderson gave a gambling response, saying he hoped he would never "talk down to the American people," and mentioning that his father was an immigrant with an eighth-grade education.

"There was a time," said one person traveling with him, "when he would have just shrugged and said, 'Gee, I don't honestly know.'"

Reporters have found Anderson less accessible. "He has stopped giving out telephone interviews," an aide said last week when asked if the congressman would comment on his topic. "He is spending the time for reading, meditation and ratiocination." Now he has canceled all campaigning for a week.

His meditation has focused mainly on an agonized and drawn-out decision on whether to break off his maverick candidacy from the Republican Party and run as an independent.

Anderson has started taking polls instead of disparaging them. He has talked about the necessity of consulting with his "71,000 contributors" and generally has developed a certain caution. He has likened his tortured meditations to those of Hamlet.

He remains indomitably well-informed and articulate, however, and there are signs that he can be saved from himself.

For one thing, when he gets carried off in a flight of rhetorical excess, his wife, Keke, will put a hand on his shoulder and say something like, "John, nobody knows what on earth you're talking about." And he listens.

Kennedy, independently of his campaign, has undergone a strange metamorphosis from the often sullen, tongue-tangled candidate who confronted unexpectedly hostile crowds in New Hampshire to a man with a sparkle in his eye in Pennsylvania.

In this crucial state, two weeks before its primary, the crowds -- union, ethnic, industrial, Catholic -- are responsive, and the polls indicate that Kennedy has a good chance to defeat President Carter.

Still, it is not clear how much the improved crowd responses result from changes in Kennedy, or have caused them.

The senator has begun to draw praise for his humor and grace in the face of repeated and brutal rejection, and for an undeniably more polished speaking performance.

But his moods and his performance seem unrelated to his success or failure in various primaries. Indeed, those who have traveled with him have felt he was more upbeat after some of the defeats.

His aides trace the transformation back to his Georgetown University speech earlier this year where, they say, he "rediscovered his liberal voice" on the issues.

The bumbling, unenthusiastic Kennedy was, they say, an aberration created by intense press scrutiny of him before he had the usual grace period accorded most candidates, and by a number of other well-analyzed factors.

Kennedy shrugs off any complicated attempts to analyze his performance as a candidate. He steers reporters away from questions of personality -- his or anyone else's -- and back to issues.

His improved public speaking is a matter of natural evolution from Senate to presidential campaign, he says. Although years of congressional floor debate seemed to be sufficient rehearsal for Anderson, Kennedy's 17 years in the Senate did not quite prepare him for a national campaign, he and his aides say, claiming there's a big difference.

While Anderson is naturally articulate, Kennedy is casual conversation omits words and leaves sentences dangling, in what friends call "a kind of shorehand."

That tendency is evident in his impromptu answers to questions, though even his off-the-cuff responses have improved over the days when they left the press urging him to "give us a verb!"

Meanwhile, Kennedy has honed and memorized some of his formal statements, tinkering with them like a mechanic.

"This is the supri-i-i-se administration," he shouts to a roomful of labor leaders in Pittsburgh, as he has to countless crowds in recent weeks. The administration, he charges, was surprised when the Russians invaded Afghanistan, surprised at their own vote in the United Nations -- the litany goes on. "Well, with your help, we hope to give them a surpri-i-i-se on primary day here in Pennsylvania, too!"

"He came up with that 'surprise' idea himself," an aide says with pride.

"I don't feel that, you know, the test of successful speech is whether you get the people stamping their feet and cheering from the rafters," Kennedy said one day last week.

"I think there's different moods at different times, different concerns," he said. A speech is "just the opening of a process of trying to convince. The process continues."

The chemistry of a crowd, he said, "is very important . . . The increasing response we're getting from people -- that is much more moving to me personally" than anything else.

That will all change, of course, if it begins to look as though he has a real chance to win.