For generations, politicians, pundits and poll-takers have been seeking their version of the Holy Grail--a sure-fire, guaranteed way to predict presidential elections well ahead of time. It may have been found by a most unlikely duo: an American historian and a Soviet geophysicist.

When Allan J. Lichtman of American University and Volodia Keilis- Borok of Moscow's Academy of Sciences met as visitors at Cal Tech last spring, they joked about the overlap in their seemingly dissimilar fields. Lichtman, a political historian with a fondness for mathematical analysis, was trying to explain electoral upheavals and presidential landslides. Keilis- Borok was trying to refine earthquake analysis and prediction through a technique called "pattern recognition."

The joking quickly turned to a serious effort to define the historical conditions that lead to change of party control of the White House. By mathematical exercises, the odd couple eliminated some plausible factors: it made no difference if the country was at war or peace, in or out of foreign-policy crisis, or whether there was a battle for the out-party nomination. When they had finished, they were left with 13 key tests.

The first six questions that determine the winner are:

* Did the party in power receive at least 51 percent of the popular vote in the previous election?

* Is the sitting president running for reelection?

* Did he initiate major changes in national policy?

* Did the party in power achieve a major success in foreign or military policy?

* Is its candidate charismatic or a national hero?

* Was the yearly mean per-capita rate of growth in real gross national product during the incumbent administration equal to or greater than 1 percent and equal to or greater than that of the previous eight years?

The more of those questions that are answered "no," the better the chances the White House will change hands.

The other seven questions are the reverse. The more "yes" answers, the better the odds of an upheaval:

* Was there a serious contest for the nomination of the incumbent party?

* Was there major third-party or independent campaign activity during the election year?

* Was there an election-year recession or depression?

* Was there major social unrest in the nation during the incumbent administration?

* Was it tainted by major scandal?

* Did it suffer a major setback in foreign or military policy?

* Is the challenging party candidate charismatic or a war hero?

Lichtman and Keilis-Borok applied their criteria to every election in the last 120 years and published their findings in a little-noted article in the Proceedings of the National Academy of Sciences.

It might have remained their secret weapon for winning barroom election bets, but Lichtman has gone public with a popularized version in the next issue of Washingtonian Magazine.

The secret is that when there are more than five "discrepant keys" or wrong answers from the viewpoint of the party in power, it loses the White House. When there are fewer than five, it wins. When there are exactly five-- as there were in 1880 and 1912--the result is unpredictable.

There are obviously some judgment factors involved, but they are the kind that can reasonably be made in advance. Jimmy Carter, for example, had won less than 51 percent of the popular vote the last time out; he had a serious challenge for renomination; there was major third party activity; there was a recession and a major foreign policy setback (the hostage crisis); he was not charismatic and he faced a charismatic opponent in Ronald Reagan. That was seven strikes against him--two more than he could survive.

Now that they have gone public, their theory will be examined skeptically by other scholars and tested by all the political junkies as a predictive tool for 1984. It may not match Rubik's Cube in popularity, but it's better fun than counting delegates. And it can't be less reliable than the polls.