President Carter signed into law yesterday the legislation that is designed to save the Social Security system from bankruptcy by imposing higher taxes on workers and their employers over the next decade.

In a ceremony at the White House, the President declared that the bill - which ranked second only to the still-stalled energy legislation on the administration's priority list - will make the system financially sound into the next century.

"It is never easy for a politically elected person to raise taxes," he said. But the Congress has shown sound judgment and political courage in restoring the Social Security system to a sound basis."

The legislation, which Carter conceded differs in some important respects from what he proposed, will raise payroll taxes $227 billion over the next decade. It will do this by gradually increasing both the Social Security payroll tax rate. 5.85 per cent this year on both employer and employee, to 7.15 per cent in 1987, and the wage base on which the tax is imposed, $16,500 this year, to an estimated $40,600 in 1987.

There was never serious debate that some form of Social Security financing legislation was necessary, if not this year than soon thereafter. A combination of inflation, unemployment, a rising number of elderly persons relative to the size of the work force and other factors threatened the system's trust funds with insolvency in a few years. But there was considerable congressional debate over how to raise the money.

In the final version, Congress rejected two key administration proposals.

One would have imposed a higher tax on employers than employees. In the legislation signed yesterday, employers and employees will continue make equal contributions to the Social Security system.

Congress also rejected and administration proposal that would have allowed the use of some general income tax revenues for Social Security benefits when the national unemployment rate exceeded 6 per cent, as it currently does. The final compromise calls for a more progressive payroll tax that will raise the lowest-paid workers' contributions by about 15 per cent between 1979 and 1987 while about tripling the payroll tax on highly paid workers.

Acknowledging that the final form of the bill impose higher taxes than he recommended, Carter said he believes the heavier payroll tax burden can be offset by the income tax reductions that he will propose to Congress in January.

The President confidently predicted yesterday that the legislation will assure the soundness of the Social Security system until the year 2030. However, according to an analysis by reporter Brooks Jackson of The Associated Press, that prediction is based on some highly optimistic projections, and even those would not assure the soundness of the system for the next 75 years - the period over which Congress traditionally project Social Security taxes and benefits.

The optimistic assumptions include predictions of drop in the inflation rate to 4 per cent a year of an increase in wages so they exceed the annual cost of living rise by 1 per cent a year, and of a reversal of the trend toward a steadily declining birthrate in the nation.

If there are to be enough workers earning enough money to generate sufficient payroll taxes under the higher tax rates signed into law yesterday, these projections must become reality.

The President also signed legislation yesterday prohibiting American firms from paying bribes to foreign officials to obtain business, and increasing disclosure requirements on domestic and foreign investors' ownership of American corporations' stocks.

Yesterday was Carter's last full day in Washington this week and was crowded with meetings, including one with former President Ford. The White House provided no details on that or the other meetings.

Today, the President will leave for Christmas at home in Plains, Ga. He is scheduled to return to Washington on Monday and, three days later, leave on a trip to six nations.