The Social Security system has become a leading presidential campaign issue in a curious inverse bidding war as to which candidate -- President Reagan or Walter F. Mondale -- will do the least to the program if elected.

The politics of the competition is obvious. Almost every American worker pays into the system, and one-seventh of the population looks to it for income.

But the candidates' promises have also had other effects. By pledging not to cut benefits in a program that now represents about one-fifth of the budget, the presidential contestants have taken off the table one of the most important means of trimming the $170 billion federal deficit that both insist they want to reduce.

Their one-upmanship has also worked in some ways to perpetuate the mythology that has surrounded and to some extent blocked reform of Social Security over the years.

An example of both points came in the presidential debate a week ago when Reagan mistakenly asserted that "Social Security has nothing to do with the deficit."

"Social Security is totally funded by the payroll tax levied on employer and employe," he said. "If you reduce the outgo of Social Security, that money would not go into the general fund to reduce a deficit. It would go into the Social Security trust fund. Social Security has nothing to do with balancing a budget or erasing or lowering the deficit."

In fact, Social Security has been part of the federal budget since 1969, when President Lyndon B. Johnson "unified" the budget at the recommendation of a special commission. The system is self-contained in that its taxes can be spent only for benefits, and surpluses accumulate. But the taxes count as federal revenues; the benefits count as federal spending. Thus, if spending is lowered, the size of the deficit is reduced.

Since he suggested 20 years ago in a nationally televised speech for Republican presidential nominee Barry Goldwater that Social Security should be made voluntary, Reagan has foundered on the issue, and it may have cost him support again this fall. A Washington Post-ABC News poll taken after the Reagan-Mondale debate showed that Mondale enjoyed a sharply improved standing among voters over 61.

The sudden emergence of Social Security as a volatile element in the campaign also brought along many other myths and charges.

Mondale has tried to portray Reagan as an insensitive budget-slasher with a "secret plan" to trim Social Security benefits in a second term. Reagan has tried to portray Mondale as a tax-raiser who again would take a bite out of workers' paychecks.

Both tended to overlook the fact that the last major Social Security financing crisis was resolved with a bipartisan compromise that included a carefully negotiated package of benefit cuts and payroll tax increases. Republicans accepted the tax increases they didn't like, Democrats the benefit cuts.

Alan Greenspan, a New York economist and an informal Reagan adviser who headed the Social Security commission, said he is "chagrined" that the issue surfaced in the presidential campaign. Greenspan said he fears that the partisan bickering could make future compromise on fiscal issues more difficult.

"I thought the bipartisan commission sufficed to put the issue behind us," he said.

To the contrary, Reagan and Mondale in some ways are using Social Security as a metaphor for their larger differences on tax and spending policy.

Mondale, attempting to drive home the "fairness" issue, criticized Reagan for proposed Social Security cuts that hit the "poorest" senior citizens and widows sending their children to college.

Reagan, trying to drive home his claim that Mondale would raise taxes, linked the former vice president to the 1977 Social Security payroll tax increase, "the biggest single tax increase in our nation's history."

This year's generational politics also seemed to filter into the arguments. Reagan has done well among younger voters and focused his fire on tax increases, which many of them feel most directly; Mondale stressed benefit cuts in a way to instill doubt about Reagan's intentions among traditional Democrats.

During the debate, Reagan promised never to reduce benefits for "the people that are now getting them." He thus left open, as he has for most of his term, the question of what would happen to future beneficiaries. After prodding from Mondale, the president expanded his pledge to include future retirees, promising that he would never tamper with Social Security, including cost-of-living increases.

In a fresh display of sensitivity to the issue, Reagan also told audiences Friday in his Ohio whistle-stop tour that "If there's anyone in my administration that has such an idea" of tampering with Social Security, "he's gone tomorrow morning. Because there isn't anyone on our team that believes that."

When the candidates "focus on a list of who will not cut what," said Greenspan, they "effectively eliminate the possibility of ultimately coming to grips" with the deficit through a bipartisan compromise.

Already, numerous sections of the budget can't be cut, including interest payments on the national debt, an estimated $130 billion this year, and defense, which both Mondale and Reagan would increase, but at different rates -- $266 billion this year. Putting Social Security on this list adds $189 billion to that total.

In other words, with all these doors closed, less than half the $930 billion federal budget can be targeted for possible cuts, and the remainder has already carried the brunt of the cuts in Reagan's first term.

Mondale has also ruled out cuts in a host of other areas, such as student aid and Medicare. He has proposed tax increases instead. Reagan says economic growth will bring down the deficit without tax increases. But both are pinning their hopes on some future spending cuts, although neither has completely detailed his plans.

For all his past difficulties with Social Security, Reagan and his subordinates have continued to suggest that they want to make major changes in a program considered the most sacrosanct in American politics.

In March, Reagan speculated about "revamping" it; later he said that young people were paying more in taxes than they would receive in benefits. Treasury Secretary Donald T. Regan said Social Security would have to be "revisited" later in the decade, possibly with benefit cuts for those at the upper end of the income scale.

Democrats delight in such speculation. "It's political quicksand," said Christopher J. Matthews, spokesman for House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.), who has never missed an opportunity to skewer Reagan on the issue. "The more he Reagan squirms, the deeper he sinks," Matthews said.

Spawned in the Depression, Social Security was vastly expanded in the post-World War II period of economic growth by adding new categories of beneficiaries. Benefits were increased as growth produced a surplus of payroll tax revenues. Finally, in 1972, benefits were automatically linked to inflation.

But a retrenchment began in the late 1970s as the economy stagnated and runaway inflation drove up benefits. The 1977 rescue package was largely a tax increase; by 1981 another retrenchment loomed as inevitable to keep the system solvent in the short term.

Reagan won some early benefit cuts from Congress, but a big second package of benefit reductions in May 1981 proved to be a political fiasco that led to the Greenspan commission. Democrats used the issue against Reagan and the GOP in the midterm campaign, gaining 26 House seats.

The big savings in the 1983 bailout came from a six-month delay in the automatic cost-of-living increase, and the escalation of scheduled payroll tax increases. The system's trustees say it is now sound through at least the end of the decade and probably beyond.