President Carter signed the last major piece of this energy program into law yesterday, providing $20 billion in government loan and price guarantees to speed production of synthetic oil and gas from the nation's vast coal and shale reserves.

"This is a proud day for America," said Carter at a White House ceremony yesterday.

The program is intended to produce the equivalent of 500,000 barrels of oil a day by 1987.

Then, if the economic, environmental and social problems of full-scale synfuels development have been mastered, the program calls for a tripling of government support, adding $68 billion in order to produce 2 million barrels of synfuels a day by 1992.

The Energy Security Act, introduced amid the gasoline lines and price explosion that followed the Iranian revolution, took nearly a year to win congressional approval. The 1992 goal if achieved would mean a substantial reduction in U.S. dependence on imported oil, which now totals more than 6.5 million barrels a day.

The U.S. oil picture is much improved over that of a year ago. Imports so far this year are 12 percent below those at the same time in 1979, and motorists have reduced gasoline consumption by more than 8 percent.

But congressional support for the production of synfuels remains strong because of the insurance they could provide by the end of the decade.

"The keystone of our national energy policy is at last being put in place," Carter said.

Hundreds of energy companies are already lining up for the loan and price guarantees that will be issued by the new Synthetic Fuels Corp. The government backing is meant to help utilities, pipelines and energy companies borrow construction funds to build first-generation synfuels pilot plants. In most cases, there would be no cost to the government unless the projects failed to operate, or produced an expensive product that needed a government subsidy to be marketed.

The program also provides $5 billion to finance solar energy projects and energy conservation, including improved insulation for low-income households.

With the exception of the ongoing debate over nuclear power policies, enactment of the synthetic fuels act essentially ends the long effort to produce a new energy policy that began with Carter's 1977 speech calling the issue "the moral equivalent of war."

The policy permits a rapid escalation of natural gas, oil and fuel prices in hopes of stimulating exploration for new U.S. reserves. An oil tax has been passed to capture some of the profits from higher energy prices for the government's use.

But Congress blocked Carter's attempt to impose a fee of 10 cents a gallon to help discourage use of gasoline and last week decisively rejected another major administration bill to speed government approval of high-priority energy facilities such as refineries and pipelines.

The latter setback, on the proposed Energy Mobilization Board, apparently dashed hopes of White House aides for a July 4 spectacular, celebrating passage of the president's full program.

The House sent the mobilization board bill back to committee, with Republicans and Democratic liberals combing forces.

House Speaker Thomas P. O'Neill Jr. (D-Mass.) said yesterday he has not given up hope of winning approval of the mobilization board bill, despite the 101-vote margin of defeat last Friday.

O'Neill accused House Republicans of making the bill a campaign issue, noting that 95 Republican members who had once supported the bill turned against it Friday. The motive, he charged, was to derail administration plans for a presidential trip from San Francisco to Miami July 4, to highlight progress toward energy independence.

Carter took a milder view yesterday at the bill-signing ceremoney.

"The fight for energy security is not a partisan fight," he said. "I ask members from both parties to complete our energy agenda in the same spirit of cooperation that has brought us the success which we are celebrating today." o