SOCIAL SECURITY, which will pay out $164 billion in cash aid to 36 million people next year, is the nation's largest and most successful social program.

But while Social Security has done marvelous things for America, resucing the aged from poverty and protecting the disable from destitution, it is in trouble.

Nobody looking at the deficit projections for the old-age trust fund is complacent. A year or so down the road, the fund simply won't have enough income from the payroll tax to meet all its obligations.

That wasn't the way it was supposed to be when Congress in 1977 legislated a stiff new schedule of payroll taxes, the largest peacetime tax increase of any type in history. That increase was widely trumpeted as guaranteeing the old-age and disability trust funds would stay in balance well into the next century.

Now, only four years later, the program is facing a funding crisis with predictions that some time in 1982, the cash window for the old-age program will be closed, and tens of millions of people whose economic security absolutely depends on Social Security will get truncated benefits or none at all.

"The question before Congress is whether the 36 million Americans who currently depend on the Social Security system can count on any check at all less than two years hence," Office of Management and Budget Director David Stockman warned a House subcommittee recently.

"The most devastating bankruptcy in history will occur" some time in the fall of 1982, he predicted.

That is pretty strong language and a great national debate has now began over just how sick the system is, how it got that way and how to fit it.

J. J. Pickle, the Texas Democrat who heads the House Subcommittee on Social Security, repeatedly has said he believes the old-age and disability trust funds are going to need about $100 billion more over the next five years than will be produced by the payroll tax that is levied 50-50 on employers and employes.

Two of nation's most unyielding opponents of cuts in Social Security, former commissioner Robert Ball and former HEW secretary Wilbur Cohen, think this figure is way out of line, far too high, based on an exceptionally pessimistic view of developments in the national economy.

And the administration, in what can only be called a fit of statistical schizophrenia, has declared that the economy will do so well that, actually, Social Security will need only about $11 billion extra over the next five years to pay all benefits and build up trust fund reserves a bit -- but then has turned around and asked for $82 billion in cuts.

Social Security has become the main income transfer mechanism in the economy, taking billions of dollars each year from workers through the payroll tax and transferring the money to those forced out of work by disability and age and to survivors of workers who died.

It operates on a pay-as-you-go basis, keeping only enough money in the trust funds to pay a quarter or half a year's benefits. The taxes of people working today are used to pay off the benefits of the generation now retired; and when today's workers retire, their benefits will be paid by the next generation of workers.

Eligibility and monthly benefit amounts are related to how much a person earned in jobs covered by Social Security during his working life; but, unknown to most people, the benefit structure is highly progressive, favoring lower-income workers.

A person who worked all his life at around the minimum wage will have benefits under existing law equal to about 55 percent of his final year's salary prior to retirement. One who worked for average pay during his lifetime (about $13,800 a year at present) will have benefits of about 41 percent of his final year's pay. And one who worked at the maximum taxable wage all his life will get benefits equal to about 28 percent. (The system was designed to provide part of a person's income in retirement, but not all of it.)

On the other hand, the tax structure is regressive, weighing more heavily on the low-income person because there is a ceiling on taxable wages.

This year, for example, the ceiling is $29,700. A worker earning $10,000 a year pays 6.65 percent of his earnings, or $665, in Social Security taxes. But a worker earning $50,000 only pays 6.65 percent of the first $29,700, or $1,975 in Social Security taxes. His tax on his overall $50,000 income is only 3.95 percent. And of course, he gets credit only for the $29,700 on which he paid.

Until 1972, there was no provision in law for automatic annual cost-of-living increases for Social Security beneficiaries and it was the common practice of Congress in the 1950s, 1960s and early 1970s a raise benefits periodically, often in election years, to help keep benefits up with inflation. This was easy to do, even without massive tax increases, because the system, having started only in 1935, didn't yet have a full complement of beneficiaries on the rolls.

Partly because of these increases and partly because of the "maturing" of the system and the widening of the scope of benefits brought more people onto the rolls, the number of elderly people below the poverty line fell dramatically. In 1959, the poverty rate for people 65 and over was 35.2 percent; by 1979, it was about 15 percent.

Social security had more to do with lifting people out of poverty than all other programs combined; in 1976, it was estimated, three-fifths of the elderly got at least half their income from Social Security payments. That doesn't even count millions of younger people who are on the rolls because of they are disabled or are the children or dependents of disabled or decreased workers; all told, one American in seven is dependent on Social Security.

Partly to restrain its own instincts for increasing benefits, since the elderly were becoming an increasingly potent political bloc (and more so today), Congress in 1972 moved to put the system on automatic pilot, providing for automatic "indexing" (annual increases based on ways and costs of living) of both taxes and benefits.

The cost-of-living feature for persons who are already retired and receiving benefits is an absolutely crucial security protection for the aged and disabled, who generally are less able to work and have fewer ways to make up income loss when inflation hits. It guarantees that the value of your social security benefit will not shrink to a pittance because of inflation, as is often the case with private pensions which seldom have an automatic cost-of-living provision.

The underlying assumption of the indexing decision was that productivity in the United States would continue to increase rapidly and that wages would therefore rise faster than prices each year. That would provide Social Security with enough tax income from wages to pay for anticipated benefits.

But this hasn't happened. Basically, the reason Congress and the president are facing a crisis is that the planners in 1977 made a terrible booboo, not just those in the Social Security administration but all the top economists government-wide.

They simply failed to foresee the soaring inflation and high unemployment that began only a year or two, after President Jimmy Carter had happily placed his signature on the 1977 Social Security bill.

With the price increases outrunning wages, indexed benefits began growing much faster than expected; and with unemployment higher than expected, payroll tax income to the system grew proportionately slower.

This collapse in the growth of productivity in the economy is unusual and isn't expected to continue long, but for the moment, it has produced Social Security's short-term problem, the one evoking all the immediate hysteria: a shortfall of money in the old-age and survivors' insurance trust fund a year or so down the road.

But there is also a long-term problem, though it won't become serious until after the turn of the century. As the post-World War II baby boomers move through the system and eventually retire starting in 2005, there will be a huge load of beneficiaries and a relatively shriveled active labor force (because of low birth rates after the boom ended) to support them. Today the aged constitute about 11 percent of the population; this will rise to about 16 percent in the first quarter of the next century.

Today there are about three active workers contributing payroll taxes into the system for each retiree; by the end of the first quarter of the next century, the ratio is expected to be 2 to 1.

Since Social Security is essentially a pay-as-you-go system, this could mean a crushing tax burden on the active labor force to support the retirees. Of course, the demographics could change and the picture could turn out to be less troublesome than it now looks, especially since people will also have fewer children to support and might find it easier to pay taxes to support the elderly; but the outlook is certainly for heavy burdens.

These developments set the stage for President Reagan's call for sharp reductions in Social Security benefits for those first going on the rolls after the end of this year. Instead of raising more money by raising payroll taxes or by infusing general Treasury revenues into the trust funds to meet the deficit, Reagan prefers to cut benefits by $82 billion over the next 5 years.

The Reagan proposals include, for starters: elimination of the $122 a month minimum benefit; elimination of the student benefit (normally a dependent minor goes off the rolls at age 18, but he can keep on another four years if in college), and elimination of the $255 lump-sum burial benefit in some cases. In addition, Reagan would:

Change the basic formula for future retirees, so that a worker making the average salary would have an initial benefit equal to about 38 percent of his final month's wage instead of 41 percent. This represents a cut of about one-twelfth in basic benefits. It would save many billions and is the biggest saver among all the Reagan proposals.

Sharply reduce eligibility for Social Security disability insurance, cutting back the program by about a third and forcing many disabled to seek welfare.

Drastically reduce benefits for persons choosing to retire in the future before reaching 65. At present, an individual retiring at 62 (the minimum age) gets benefits equal to 80 percent of the amount he'd get at 65. The Reagan plan cuts this to 55 percent. Combined with the basic benefit formula change, this proposal would mean some future age-62 retirees would receive 43 percent less in monthly benefits than under current law and some would retire with a benefit permanently cut to only one-fifth of their final paycheck.

Carry out a Reagan campaign pledge and remove altogether by 1986 the current $5,500 annual limit on what a retiree of 65 or over can earn without any loss of Social Security benefits. The added cost to the trust funds would be offset by the proposed cuts.

Most of these changes would not affect people already on the rolls, and would apply only to future retirees, a point repeatedly stressed by Reagan.But the elimination of student benefits and minimum benefits and a three-month postponement of the 1982 cost-of-living increase would be applicable to those already on the rolls as well as to future retirees.

The Reagan proposals brought a firestorm of protest from Cohen, Ball and organizations representing millions of workers and beneficiaries.

Cohen and Ball called the cuts savage and Draconic and far deeper then needed just for the solvency of the system.

The whole argument turns, essentially, on what you expect to happen in the economy, and on that, Cohen and Ball would seem to have a point even if you don't swallow their whole argument.

Take the short-run problem first. Reagan's official, optimistic projection is that unemployment will be dropping below 6 percent by 1986 and inflation to 4.2 percent by 1986.

Under the administration's own calculations, if indeed this proves to be the case, then Social Security will be able to pay all benefits and build the trust funds rapidly up to a 17 percent reserve merely by allowing borrowing among the three trust funds and finding $11 billion in cuts or new revenues from 1982 to 1986. Yet the administration has asked for cuts that will total $82 billion over those years. It says the extra $70 billion could be used to build the trust funds up to an even larger reserve.

Let's say they really don't have that much confidence in their rosy projections. Under their most pessimistic scenario, unemployment will be nearly 10 percent in 1983 and inflation won't drop below 10 percent until 1986; in that case, Social Security would need roughly $111 billion in new funds or cuts over the next five years to stay solvent and build up trust fund reserves substantially.

But this short-run scenario seems unduly pessimistic. Inflation and unemployment already are both substantially lower than envisioned in the pessimistic scenario. Unless Reagan wrecks the economy, things will be better in the 1980s than the pessimistic scenario assumes.

In short, the administration is probably asking for too big a cut to meet the immediate crisis (and, of course, you could also meet it by raising taxes or infusing general revenues instead of cutting). Interestingly enough, Stockman all but conceded that the $82 billion figure may be too high when he told a congressional committee that the real size the next five years probably will be somewhere between the $11 billion figure and the $111 billion.

The same analysis holds for the long-range deficit. There is very little reason to use either the most optimistic demographic and economic assumptions or the most pessimistic in judging the system's financial condition beyond the turn of the century.

The pesimistic assumptions, after all, assume virtually no growth in the productivity of the economy for the next few years and an extremely low rate beyond that.

As in the past, the Social Secutiry Administration has made its long-range forecasts using the middling projections, as seems the most prudent, but then, inexplicably, it has asked for cuts totaling almost exactly twice as much as needed to cover the projected long-range deficit.

For both the short term and long term, the administration justifies its request for cuts bigger than really seem to be needed by saying an extra margin of safety is being sought, in case the economy turns out worse than hoped.

That is a reasonable argument, but the proposed cuts are so far out of proportion to what seems to be needed except in the most pessimistic case (they even allow for cancellation of part of the scheduled 1985 Social Security tax increase) that one suspects there is something more at work here.

One suspicion is that what Reagan is really seeking to do here is balance the overall federal budget at the expense of Social Security benefits. Stockman actually has made no secret of the fact that he expects horrendous difficulties in balancing the budget and that Social Security can make a contribution to this process. Secretary of Health and Human Services Richard S. Schweiker, on the other hand, has denied that general federal budget matters were involved in his recommendations on the Social Security, saying he simply wanted to have an extra margin of safety in case the economy turns sour. Yet the suspicion remains.

There is something more. Some of the economists and advisers clustering around the Reagan administration seem to have an ideological vision of Social Security as properly a leaner system than now, relating benefits more to how much you pay in an deliminating what are called "welfare aspects" of Social Security, such as a variety of special dependents' benefits, the minimum benefit, the student benefit and aspects of disability eligibility that are based on age and skills as well as physical impairment for work.

Stockman and Schweiker have repeatedly said that to fill some of the protective gaps left by cuts they propose, there is a welfare system and there is no reason why people should be getting Social Security benefits of some types as a matter of right when protection for them exists on a need-tested basis in the welfare world.

The Reagan package, in short, seems to be fashioned in part on the basis of a world view that sees the system as having grown too large, and as attempting to do too much, and therefore as costing too much. Administration talk of Social Security's role in the "saftety net" seems to emphasize the retirement benefit received by a worker as the primary benefit in the system and regard much else as merely "fringe benefits."

Both Schweiker and Stockman have expressed the view that one of the problems of Social Security is that too many fringe benefits have been loaded onto it in recent years in the laudable, but ultimately unmanageable, hope of providing virtually everyone with true economic security of a sort.

They argue that the student benefit is one example; another, the minimum benefit which goes in some cases to well pensioned civil servants who get plenty from federal civil service pensions and worked in Social Security-covered employment only a few years.

They say disability benefits should go only to those with the most severe physical ailments; others can go on the charity disability welfare program entailing an needs and income test.

They say the basic level of benefits under current formulas are a little too rich. They say people who want to retire at 62 and enjoy leisure while others are laboring until 65 must pay the financial penalty.

Only by cutting back these "fringe" benefits will it be possible to guarantee financing for what must remain the primary function of the system, they argue: a basic pension for retirees.

Critics of the administration proposals have counter-arguments on most of these contentions: Ball, for example, has said that a recent study shows that 57 percent of those who retire at 62 actually do so because they are in ill health, and another 14 percent because they are out of work and can't find jobs.

This being so, they argue, a proposal that would cut back early retirement monthly benefit levels as much as two-fifths from present law and leave a benefit equivalent to only 20 percent of what the individual earned before retirement is not merely an adjustment but a tremendous rip in the safety net.

Others argue that two-thirds of those receiving students benefits are of relatively low income and may have to discontinue education if student benefits are killed at the same time that guaranteed and direct college loans are being cut back as part of Reagan's proposed cuts in education programs.

There are already considerable signs that members of Congress believe the Reagan plan overreached and asked for too much. The Senate, on a 96-to-0 vote, signaled a few days after the Reagan plan was announced that it would not accept it and Reagan had to offer a promise to compromise to help calm things down. Undoubtedly, Reagan's proposals have left a residue of suspicion and enmity among affected groups and in general among opponents of social programs cuts.

But in the long run, the political damage may not be too great. There is generally a perception that something must be done, that it may require either higher tax burdens or some surgery (if much less than he asked), and that some bipartisanship is needed to fashion a solution. If he can reach a genuine compromise with Congress, everybody may be so happy the problem is solved that he mey get off relatively lightly.