British Prime Minister Maraget Thatcher has come to Washington at an opportune time. Her presence is a reminder to President Reagan and the nation that good intentions do not always produce desired results.

Eighteen months ago, the Conservative leader was pointing Great Britain toward a new economic course, with a bold show of energy and confidence that even a David Stockman might have envied. But today, with inflation and unemployment both on the rise, the prime minister is a bit beleaguered, if still far from bowed.

When Stockman, Reagan's young budget chief, was asked about the Thatcher experiment at a hearing of the congressional Joint Economic Committee last week, he answered -- a bit ungallantly -- that the lady had got it all wrong.

"Taxes and government spending [in Great Britain] have increased, not decreased," he told Rep. Parren J. Mitchell (D-Md.), "The growth of the money supply has been high, not low. What has been implemented has failed, as one would have expected," said the fellow who invited the congressmen to call him by his new nickname, "Deep-Cut Dave." And besides, he said this has nothing to do with Reagan's program for economic recovery.

Well, maybe. But there is one similarity. What Thatcher was trying to do was administr shock therapy to a slothful economy, not just with policy but with rhetoric. She told inefficient manufacturers they were coming off the government dole, like it or not, and she told workers, "You'll enjoy a German standard of living when you work like Germans."

The more one examines the Reagan economic program, the more it too appears to be a form of psychological shock therapy. There is an underlying economic theory, but at root, the president's proposition is that economic problems will get better when we think they are getting better.

As Reagan's budget document put it, "Central to the new policy is the view that expectations play an important role in determining economic activity, inflation and interest rates. . . . Establishing an environment which ensures efficient and stable incentives for work, saving and investment now and in the future is the cornerstone of the recovery plan."

"Establishing an enviroment" is also a tircky exercise in mass psychology. Reagan has been masterful so far in creating a sense of confidence in his leadership and an expectation of rapid and salutary action. But the more people examine economic assumptions underlying his plan -- the more they peek behind the wizard's curtain -- the more skeptical they seem to become.

When Secretary of the Treasury Donald T. Regan went before the Joint Economic Committee last week, he was forced to admit that the administration plan assumed sustained and rapid growth in business investment greater than this nation has known in its entire previous history.

The Washington Post Quoted economist Otto Eckstein as saying such investments rates "would require a massive restructuring of the American economy." Irving S. Shapiro, the chairman of DuPont, told The New York Times, "All we've got to rely on is an economic theory. No businessman can run his company on an untried business theory." Rudolph G. Penner, a senior economist in the Ford administration and now at the conservative think tank, the American Enterprise Institute, called the Reagan plan's economic assumptions "particularly worrisome." Even a 1 percent shortfall in assumed economic growth could tilt the budget deficit upward by $10 billion, he said.

What is particularly striking -- at least to a layman -- is the apparent assumption that the work of "establishing an environment" for this prodigious economic risk-taking and investment at home will not be disturbed by any uncontrolled events outside our borders. So far as one can judge, there is no allowance for another Opec oil-price jolt, for an eruption in the Persian Gulf, for a Soviet move into Poland or for a U.S. showdown with Cuba over aid to El Salvador, to mention just four not entirely theoretical possibilities.

On "Face the Nation" last Sunday, when Stockman was asked about these uncontrollable factors, he seemed to suggest that the effects could be cushioned if the Federal Reserve Board just kept a firm grip on its monetary policy.

To a non-economist, that sounds an awful lot like whistling your way past the graveyard. But maybe Margaret Thatcher will give her American cousins lessons this week in how that is done.