More than a year ago, David A. Stockman tried in vain to make President Reagan understand the intricate difficulties of shrinking the federal budget.

He paraded before Reagan a number of Cabinet officials who argued against various budget cuts. This was supposed to make the president realize it was more difficult to reduce the budget deficit than his own rhetoric had led him to believe.

It didn't work. Reagan resolved various budget disputes, but failed to draw Stockman's desired conclusions about the persistence of a larger deficit problem, according to several White House and administration officials.

Last fall, when it was time to begin the process again for the fiscal 1984 budget proposal sent to Congress last week, Stockman, director of the Office of Management and Budget, took a different tack. He devised a series of striking visual presentations that showed the harsh realities of the federal budget.

Reagan responds to charts and graphs. The ones Stockman presented portrayed a looming "structural deficit" that would persist for years even if major budget cuts were made. Then Stockman reinforced the message with a sobering "multiple-choice" decision paper on the budget.

On each of 50 programs, the president was asked to check one of three boxes indicating the level of spending he preferred. This actively involved Reagan in the budget process, and made him realize that a balanced budget was not just over the horizon.

Stockman, who once liked to claim he understood "how the world works," had figured out how Reagan works--and how to influence his decisions.

It was an important benchmark for Stockman, 36, the talented yet controversial budget director with roots in a Michigan farming community who left Harvard Divinity School for a career as congressional aide, Republican theorist and conservative congressman.

Considered one of the best and certainly the brightest of the Reaganites in the heady spring of 1981, when he was highly visible in the media, Stockman fell from grace for the emperor-has-no-clothes disclosures he made to writer William Greider that appeared later in a celebrated Atlantic Monthly article in December, 1981.

Stockman offered to resign then, but was kept on by Reagan after the intervention of chief of staff James A. Baker III and Vice President Bush. Since then, Stockman has operated strictly as an insider who wields influence through his encyclopedic budget knowledge and alliances with White House officials, especially Baker and presidential assistant Richard G. Darman.

Friends say that Stockman, who will be married next weekend, expects to leave government at the end of the current budget cycle, which could be summer or early fall. Stockman is expected to go into industry or finance. Friends speculate that if all goes well, he might eventually seek major political office in Michigan.

Stockman would not comment on his plans during an interview last week. But he said that he sees the third budget of a presidential term--sandwiched between two election years in which politics tends to dominate budgetary priorities--as "decisive" to the administration's fortunes.

Others close to him say he wants to see this budget through, believing that the administration, and perhaps even the Republican Party, will stand or fall on its results.

Whatever the future may hold, Stockman today is more sophisticated and subdued than the energetic young man who arrived in the second-floor office of the Old Executive Office Building in 1981.

Then, Stockman was confident he could control federal spending because he commanded a powerful understanding of budget details. Now, his associates say, Stockman has come to appreciate that budget details are not enough when it comes to changing the deeply rooted congressional politics that protect federal spending.

Then, he was confident the economy could be moved quickly, that inflation "melts away like the morning mist" without major economic dislocations. Now, associates say, Stockman has come to realize the economy cannot be moved as painlessly as he--and Reagan--had promised.

Once Stockman was a celebrity on network talk shows and the covers of news magazines. Now he has learned to practice discretion in public, and work in tandem with others, according to more than a dozen top administration officials who talked about Stockman in recent interviews on the condition they not be identified.

"He is simultaneously a virtue and a liability," said one official who admires Stockman's ability but is critical of his overall approach. "He has used up capital, but he would be difficult to replace.

"In a Cabinet with less-than-terrific members, Stockman knows more about the budget than they do. If you want a bean-counter, Stockman's the best. But this isn't what the administration should be doing now."

Stockman is, by most accounts, far more valuable to the Reagan administration in ways other than as a bean-counter. Perhaps more than anyone else in it, Stockman has buttressed with specific policy the broad outlines of the Reagan revolution. He sounded the alarm bells early about approaching deficits, and he remains a quiet but influential force in shaping budget decisions and Reagan's economic thinking.

But doubts about Stockman's work and credibility still linger. Some congressmen and Cabinet members are constantly irked because his numbers seem to be always changing. Treasury Secretary Donald T. Regan opened a press briefing on the budget last week by half-joking that it was being held at 8:30 a.m. "to keep Dave from changing those numbers anymore."

Some White House officials think Stockman isn't sensitive enough to Reagan's "fairness" problem, the perception that his policies have unfairly hurt the disadvantaged. Some say Stockman's "numbers approach" to the budget has discouraged the development of more imaginative programs, such as a far-reaching jobs bill.

"The answer is no," responded a colleague when asked if Stockman could restore his tattered credibility. "You have to realize the extraordinary credibility he had in the early days. Nobody really could quite keep up with him . . . . You got to a point most of the people took him on his word. The problem is the Atlantic Monthly thing created a level of doubt in the minds of a lot of people."

Questioned about the fallout from the magazine article, Stockman grew hesitant last week. "Well, I won't speculate on that," he said, "but I think it's kind of apparent these things don't go away."

For all the doubts, Stockman's probing intellect and his mastery of the budget is lauded even by partisan critics. Rep. James R. Jones (D-Okla.), chairman of the House Budget Committee, calls Stockman "one of the most effective defenders of policy any administration ever had."

Worried by growing deficits, Stockman first broached more than a year ago the concept of a "structural deficit" that was built in and could not be reduced by spending cuts alone. But the idea "didn't fly then," said one budget official. "People weren't ready for it."

Stockman and his aides sharpened their visual presentation to Reagan. They devised a loose-leaf book of charts and graphs spread horizontally across the page so they would be easy to read. They avoided "ponderous detail" and instead used a minimum of text, one administration official said.

To show Reagan how difficult it would be to trim the structural deficit, Stockman painstakingly divided the budget into 50 categories, each with three "levels" of funding to choose from, weighted to reflect not only the impact on programs but also the political difficulty.

After the Nov. 2 congressional elections and a series of budget briefings, Reagan made a "dry run" through the budget book, then checked off his choices. There was an internal dispute over one food stamp cut, with Stockman arguing for it and Baker opposing it in a memo. Reagan at first wrote "RR--approve," then, on second thought, crossed it out and wrote underneath, "disapprove."

When Stockman added up all the choices on Nov. 12, they produced $26 billion in domestic spending cuts and a deficit of about $150 billion for fiscal 1984, which begins next Oct. 1. Significantly, they did not include choices on defense spending, which had been put off.

In late November, Reagan gave a speech in Los Angeles that dismayed some of his aides. In a passage he had personally inserted, Reagan acknowledged the existence of the structural deficit, but seemed to suggest that economic growth was the only way to reduce it.

In Washington, budget officials feared this meant Reagan had misconstrued their message and would give up on budget cuts. "He heard the music and just didn't understand the lyrics," one administration official said.

A few days later, Stockman went to Capitol Hill. He took blank copies of the same multiple-choice budget document Reagan had used, nicknamed the "SAT test" by some officials because it resembled the college board examination.

Stockman said last week that he wanted to "put a bunch of our troops through this and see how they come out." In a closed room in the Capitol, he administered the "test" to seven conservative Republican congressmen, among them William E. Dannemeyer (Calif.) and Newt Gingrich (Ga.).

The "scores" on these tests showed that, on average, the congressmen had come out with a deficit almost the same as Reagan's, and in some cases even larger. Stockman said he concluded that the problem of significantly trimming domestic spending would be "even more difficult than we thought."

About a week later, there was a signal that the structural deficit was gaining recognition in the White House. It came in a speech delivered by Lawrence A. Kudlow, OMB's chief economist and one of Stockman's top aides. "We must come to grips with the new concept of the structural deficit," Kudlow concluded in his notes for the speech.

No one in the administration objected to the speech afterward, which encouraged Stockman and his lieutenants to move ahead, administration officials recalled.

They had plenty to do. The budget decisions Reagan had made at that point--big domestic cuts but increases in defense--were likely to be rejected immediately on Capitol Hill, as they were a year before, and new economic forecasts were being readied that would push the deficits even higher.

The revenue base was falling below projections, largely because of the recession, and every computer run seemed to push the deficits up.

"It was like losing $10 billion a week," said one official who was involved. One day, a memo from the staff, saying, "Three cheers," reported grimly that the $300 billion barrier had been broken for the projected fiscal 1988 deficit.

Stockman once said, in the early days of the administration, that he wouldn't let economic forecasts drive the budget. But exactly that was happening.

The administration's forecasts were written by the group known as "Troika 1," "T-1" for short, which included Stockman, Treasury Secretary Regan and Martin Feldstein, chairman of the president's Council of Economic Advisers.

They cautiously agreed on a pessimistic forecast in the short run, and moderate economic growth over the next five years. This drove the deficit higher than it would have been if they had chosen a brighter outlook.

On a Sunday night just after New Year's Day, while Reagan was returning from a short vacation in Palm Springs, Calif., this group met at the Treasury Department for dinner. They were joined by others, including Secretary of State George P. Shultz, who had talked with Reagan on Friday about making new budget changes.

The session was free-wheeling. But Stockman is credited by all with taking ideas from it and putting together a presentation for Reagan the following Thursday, suggesting a line of attack on deficits that became the framework for administration policy administration policy.

Only in the first week of January did Reagan take up the key issue of defense spending. It was largely decided by a separate, smaller group of aides, including White House counselor Edwin Meese III, chief of staff Baker, Shultz, Defense Secretary Caspar W. Weinberger, national security adviser William P. Clark, and sometimes Stockman.

Stockman "broke his pick," as one official put it, in earlier efforts to trim Pentagon spending. But the deficit pressures were intensifying, a point made frequently by Stockman and Baker.

The Social Security compromise rescue plan also included a six-month "freeze" in cost-of-living adjustments. This tied in to an idea Stockman had promoted from the beginning of the budget preparations: a "universal" freeze on both military and civilian pay.

"When the Social Security compromise was adopted, it meant that other government programs would have the same rule applied to them," Weinberger said in an interview. "It was out of that genesis that the freeze emerged, and it was perceived that there couldn't very well be exceptions even though it was an unhappy result as far as military pay was concerned."

"The universality idea drove this thing," added Weinberger, who eventually agreed to about $8 billion in actual spending cuts for 1984, including a one-year pay freeze. Though not a big victory for Stockman, it was not a happy moment for Weinberger.

Stockman at this time was readying another explanation of how he now believed the world works. It came in section 3 of the fiscal 1984 budget document, unsigned by the budget director but written by him. There, in the language of the budget, Stockman hinted at some of his frustrations and errors.

". . . The current services budget projections vary substantially from the path envisioned in the original economic and budget plan," he wrote. The original tax cut reduced revenues by more than $1 trillion over the period 1984-1988, he noted, "substantially more than was originally proposed." And, Stockman said, the original plan had assumed a "smooth shift" from high to low inflation, not anticipating the massive "disinflationary correction and adjustment" that ensued with the recession.

Last week, Stockman talked further about the problems of the first two years. He acknowledged that not enough attention was paid to the tight-money policy that was being used to fight inflation. "I mean, the whole economy was cut down in the process of trying to disgorge this inflation," he said. ". . . It really happened in a big way. It threw all calculations off, all projections off."

Some of Stockman's colleagues say there were other problems. "We were all green rookies," one official said, adding that Stockman, in his first crash effort to trim domestic spending, paid less attention than he should have to the Pentagon buildup, which under Weinberger's guidance was projected at higher levels than Reagan had promised in the campaign.

Another problem was the big 1981 tax-cut bill. "We wanted to cut tax rates, but the total revenue loss was much greater than we wanted, and not enough attention was paid to that," one official said.

Questioned about what he would have done differently, Stockman said last week that he should have developed alternative scenarios for the economy in 1981, but didn't have time.

Rep. Jack Kemp (R-N.Y.) and other supply-siders who pushed the across-the-board Reagan tax cuts say they feel Stockman, one of their allies in the 1980 campaign, was distracted by deficits after he took office.

Last week, Stockman said he still believed in the tax-cutting ideas "if you set everything else aside." But the reality, he said, is that the recession, combined with the rapid slowing of inflation, "adds a different perspective." The idea that tax cuts would quickly stimulate the economy "was proven not to be the case in the context" of the recession and the sudden drop in inflation, he added.

One huge problem that Stockman did anticipate was the deficit. After the administration's original Social Security reform package was scrapped in May, 1981, he privately began worrying about it, warning top administration officials in August that red ink might exceed $75 billion. Now, Reagan is struggling with deficits more than twice as large.

Some who have worked closely with Stockman say he has a need to explain to himself how the world works, and that if one version of reality is disproved, another will be created to take its place. Stockman good-naturedly accepts this description of himself.

"There was always this quest to figure out how the world works," he said. "And now I've concluded that every time I have it figured out, it moves on me."