As Sen. Edward M. Kennedy (D-Mass.) campaigns in the West during the last weeks of the primaries, the form of his 1984 campaign may be taking shape within the shadow of the present one.

While Kennedy insists that he is still competing against President Carter for the 1980 nomination, he acts like a man with a future mission of restoring the Democratic Party's liberal course.

His campaign, Kennedy said in an interview, will have proven "very much justified" if he succeeds in pointing out an alternative sense of direction for the party and the nation.

To a reporter who has spent much of the last two campaigns with Ronald Reagan, Kennedy's mood and mindset oddly reminiscent of Reagan's behavior four years ago.

In 1976 after a much closer race against an incumbent president than Kennedy has been able to make, Reagan fell short of delegates in the home stretch. The ploy of choosing Richard S. Schweiker as an advance running mate kept up the appearance of a contest, but there were those on the Reagan staff who knew it was all over.

While these aides searched for other jobs, Reagan talked increasingly of enduring conservation values and the Republican platform. He even used the same homily that Kennedy does now, declaring that "a party must stand for something."

What emerged for Reagan, after a disappointing defeat at the convention, were the themes that would become the basis for his successful 1980 primary campaign.

Some of those who saw Reagan over an extended period of time in 1976 came away wondering, as they have this year about Kennedy, whether he really wanted to be president. In any event, Reagan, at the end of his losing, was a far more accomplished national candidate than the uncertain ex-governor who had begun his campaign by putting himself on the defensive with a vague proposal to turn federal programs back to the states.

Kennedy, after the rigors of his first presidential campaign, is by any standard a better candidate now than he was six months ago. There are verbs in his sentence and some thoughtfulness in his statements. He shouts less.

When he delivered his carefully conceived challenge to Carter in which he offered to withdraw if the president debated him and won the June 3 primaries, Kennedy demonstrated a clarity and a political sense which had eluded him in much of the 1980 campaign.

Over and over in California, Kennedy's supporters say -- as Reagan's did after he found himself in North Carolina four years ago -- that the Massachusetts senator would be a winner if he had talked this way back in December.

This is probably a considerable overstatement. It is doubtful if the best campaigining in the world could have overcome the liabilities of Kennedy's personal problems, an inept media campaign and the social direction of the times.

But Kennedy now seems beyond that. He appears comfortable with himself and his issues. He also is far more aware of the reality of his political position than his formal statements about winning the nomination would indicate.

When a reporter referred recently to the "last phase of your campaign," Kennedy showed no irritation. Into laughter, which said louder than any words that he realized the accuracy of the statement.

It impresses many people that he is still trying, despite the realization that Carter will be the nominee.

"I feel stronger about the campaign now than at the outset," Kennedy said enroute from Las Vegas. "My deepest fears about the direction of this country have really come true, and I'm pretty much convinced as to the importance of the alternative policy both being heard, debated and, hopefully -- wishfully perhaps -- acted on by the American people. . . . I feel that it's very much justified my campaign."

If the losing Kennedy of 1980 in some ways suggests the losing Reagan of 1976, the resemblance ends with the candidates.

Disorganization seems too kind a word to describe the performance of a Kennedy campaign that specializes in last-minute logistical changes that confound supporters, exhaust the candidate and in some instances deprive Kennedy of badly needed local press coverage.

During Kennedy's recent western swing, at least three reporters who serve California newspapers abruptly dropped off the campaign in San Diego because Kennedy's schedulers decided at the last minute to have the candidate spend the night in Albuquerque, N. M., rather than Los Angeles. It was a baffling decision for a candidate who says that the California primary is crucial to his hopes.

Some of the difficulties are attributable to money problems, but this is hardly an obstacle unique to the Kennedy campaign. More than anything else, one gets the impression that there is no animating intelligence directing the whole adventure and that the campaign is a semi-planned series of random events which just keep occurring to little purpose.

The Reagan campaign has had its share of ups-and-downs both in 1976 and this year, and there are those who think it often has failed to give the candidate the support he deserves. But at its worst, the Reagan operation is a well-oiled machine when compared with the organization that is supposed to be helping Kennedy.