The story of Pennsylvania, as told by President Carter's men, is a tale not of narrow defeat but of moral victory.

Five days ago, pollster Patrick Caddell has told the president's inner circle to brace for the worst -- that Carter had dropped to nine points behind and that he could be headed for "another New York," which meant not just a defeat but a debacle.

What happened instead, as Caddell analyzes it, is that -- for the first time in the 1980 campaign -- Carter actually came back strongly in the final days after having fallen behind. Kennedy, meanwhile, fell significantly after having built a lead.

The moral, as the Carter campaign sees it, in an analysis that serves its own political purposes, is that Carter has now shown for the first time that he is not always destined to collapse in the final stretch -- which is the core of the Kennedy campaign's prayerful blueprint.

But the greater lesson of the last days of Pennsylvania -- which could be seen, in mirror image, in the last days of New York -- may be this: perhaps the best way for a Democrat to win in 1980 is to let his opponent look like a winner and sit back and wait for voters to become first disenchanted, then fearful, and finally to switch to the underdog.

The ebb and flow of voter discontent in Pennsylvania can be seen in a sifting of the survey analyses which Caddell was sending to the president and his other advisers throughout the primary. Caddell provided details of these results in an interview yesterday.

Caddell has polled this year in a unique two-step method designed to force those being interviewed to focus upon their choice as intently as they will when they walk into the voting booth on election day. Caddell's results, according to those in the Carter inner circle, have been far closer to the election day results than any other public surveys in this year of the volatile electorate and the misleading polls.

Caddell's technique, devised with his associate John Gorman, is to first ask the person being interviewed which candidate he would vote for. Then a short series of questions is asked that are primarily designed to get the interviewee to think more thoroughly about the decision -- and then the person is asked again to choose which candidate he would vote for. The whole process takes only a few minutes.

The results have shown that Carter loses considerable support when people are asked to re-vote -- and this second response has provided as accurate reflectin of the election day results. Example:

In Caddell's final New Hampshire poll, the initial choice seemed to show Carter favored over Kennedy by 55 to 30 percent, which was about what the Boston Globe poll also showed. But the follow-up second "vote" response picked up latent anti-Carter sentiment and showed a 49 to 38 edge, Caddell said, which was, in fact, the way New Hampshire voted on election day.

In New York, where all the polls were showing large Carter margins, Caddell's poll the Sunday before election day showed a first response that seemed to give Carter a 53-to-39 lead. But the second response showed Kennedy vaulting into the lead by 43 to 37 percent -- with the undecided vote all going Kennedy's way, the anti-Carter vote soaring, and concerns about Kennedy's personal character disappearing just as rapidly. On election day, Kennedy won a landslide victory that stunned most observers, but not those who had had access to Caddell's final poll.

In Pennsylvania, in the first days of April, Caddell's first response figures were similar to margins in other polls. They showed Carter leading Kennedy by 53 to 30 percent.But the second response total showed a sharp reversal -- with Kennedy edging Carter, 43 to 40.

Economic and foreign policy concerns seemed to be working against Carter. But mainly, Kennedy's negative considerations, concerns about personal character and morality, were just half what they were in most states, including New England. "It was New York," Caddell recalls.

As Kennedy's apparent lead held for one week, the Carter strategists made two key decisions. First, they decided to leak their 43-to-40 Kennedy lead statistic, in order to get the public to focus on the possibility that Kennedy might ultimately win the nomination. Second, Carter media adviser Gerald Rafshoon decided to air a series of negative man-in-the-street television ads showing people saying that Kennedy was too liberal, too inconsistent, a big spender, and so on.

By Friday, Kennedy had jumped out to a nine point lead (47-to-38) in Caddell's second response figures. But the voter attitude questions showed a sharp increase in the number of people who believed Kennedy could win the nomination -- and this was followed in the next few days by an increase in voter concerns about Kennedy's personal character.

Finally, on Saturday and Sunday, Caddell took one last poll. The first response figures seemed to show Carter leading Kennedy by 47 to 31.

But the crucial second response preference showed Pennsylvania dead even, with Carter and Kennedy each at 40 percent. The undecided voters had changed. No longer were they mostly conservative, mostly Protestant, and mostly older -- in short, mostly disillustioned Carter types.

Now they were mostly liberal, mostly Catholic, and mostly middle aged and younger -- in short, they were mostly disillusioned Kennedy-type voters.

And on election day, these undecided voters divided just about evenly, allowing the Carter officials to claim their moral victory.