Long before President Reagan handed David A. Stockman an eraser and turned him loose on the federal budget, Stockman wrote of the political pitfalls in trying to restructure government spending. But so far Stockman hasn't fallen. His just-concluded six-week effort to cut the budget has left most of his critics clutching at thin air.

Stockman lost a few. He came away empty when he attempted to eliminate some of the special "tax expenditures" that benefit selected segments of society. He was defeated, for example, in an attempt to go after the tax-exempt status of industrial development bonds.

Reagan also overruled Stockman and refused to impose a 2-cents-a-gallon increase in the gasoline tax. And private plane owners and pilots exerted enough pressure to abort most of Stockman's proposed tax increase an aviation fuel.

Yet, in other battles over foreign aid, Urban Development Action Grants, bilingual education, the Federal Trade Commission, Stockman was dextrous enough to win even while giving the appearance of losing.

He also partially disarmed critics waiting to jump him for ignoring special benefits for generally prosperous elements of society. He made nicks, if not real cuts, in subsidies for the maritime industry and tobacco growers as well as a number of water projects and some veterans' benefits.

Stockman's high-wire performance, conducted at a hectic pace hip-deep in leaks that gave him political soundings as he progressed, realized Reagan's goal of keeping the fiscal 1982 budget under $695.5 billion -- and it has altered the political debate. By starting off with such big cuts, particularly in programs aimed at helping the poor, Stockman has moved the middle of the debate, the point of likely final compromise, far to the right.

The debate for this year and probably years to come is no longer over what newly discovered squeaking wheels need the oil of new programs, but rather over which existing programs must be preserved.

Yet the Reagan-Stockman cuts stop far short of the fundamental reordering of the nation's social programs that Stockman called for in a 1975 article titled "The Social Pork Barrel." The most expensive entitlement or benefit programs, Social Security and Medicare, remain generally unscathed.

"As we move into the future," Stockman said this week in words that ring new alarms for his opponents, the administration will be looking for ways to make structural changes in this entire system of entitlements. But Stockman also recognizes the political limits on his actions; he intends to index Social Security benefits so that they keep pace with inflation.

Needing $29.8 billion in budget cuts to keep on the proclaimed course in 1983 and an additional $44.2 billion in order to meet Reagan's promise of a balanced budget in 1984, Stockman's job gets harder. "I don't think it's easy to cut any federal program," Stockman said this week. If there were any easy cuts, he took them this time.

Stockman's invasion of the sanctuary where maritime subsidies, veterans' benefits, water projects and tobacco subsidies have rested didn't capture many dollars, but may set a procedent that he can exploit in making further cuts.

In dealing with opponents during the last six weeks, Stockman's pattern seems to have been to save a program in name if it didn't cost many dollars.

When the nation's mayors balked at losing the Urban Development Action Grants as a separate program, Stockman let UDAG survive, but so weakened that some observers are betting the mayors will find their victory brings them more trouble than benefit.

When Education Secretary Terrel Bell went to bat (with the nation's Hispanics behind him) to keep a separate program for bilingual education, Stockman gave in. The program stands -- but he cut the dollars.

When defenders of the Federal Trade Commission protested that its Bureau of Competition should not be eliminated, Stockman also yielded, but still cut the FTC budget by the same dollar figure and left it to others to decide how the cut should be applied.

On one program, the Clinch River breeder reactor, that Stockman publicly opposed when a member of Congress, the budget director simply was overwhelmed by poltical pressures. When reporters asked him to explain how the breeder reactor escaped his knife, Stockman replied: "I would have to suggest to you here that I am not running this government single-handedly."

Nor is the Congress guaranteed to be as quiet about the death and destruction of scared cows when it actually considers the budget cuts as it has been for the past six weeks. Stockmam, in "The Social Pork Barrel," drew a disparaging picture of members of Congress.

"If Members were ever legislators and statesmen, they have more and more taken on the characteristics of constituency ombudsmen and grant brokers," he wrote.