Budget director David A. Stockman, who has been resisting pressure to provide additional relief for credit-squeezed farmers, said yesterday that many growers will be forced out of business in the coming shakeout but "that is the way a dynamic economy works."

The Office of Management and Budget director, in the latest of a series of blasts at beneficiaries of federal subsidies, said there is "overinvestment" in agriculture today and predicted several years of "disinvestment" in which acreage is scaled back, farmers reconsider spending on such things as irrigation and fertilizer, and many are forced to quit agriculture.

"And it's not nice to talk about and I think you shouldn't be unsympathetic to the people involved," Stockman said in a breakfast meeting with reporters. "But, look, we have lost one-fourth of our savings and loan institutions over the last four years because that structure was no longer viable in a deregulated financial environment.

"We've probably lost a good 30 to 40 percent of our auto production workers, at least -- maybe 50 percent; I haven't checked -- relative to late 1978, because that industry had to adjust, slim down, modernize and so forth," he said. According to the Labor Department, employment in the auto industry fell by almost 25 percent from 1978 to 1983.

"So these disinvestments occur at the same time that these massive explosions of new jobs and investments are occurring elsewhere, in Silicon Valley," Stockman said. "And if you want an economy that is productive, that maximizes growth, income, opportunity over time you have to encourage both the investment and disinvestment, you've got have adjustment," he added.

"The government basically is a reactionary institution that tries to foster one and retard the other and it usually makes a botch of both," he said. "That's why we want to have a kind of hands-off industrial policy."

Stockman said "there is a fundamental shakeout that is going on out there in the farm credit structure that is necessary because the economics on which its based is faulty.

"As a political matter, if the first thing we do out of the box in this year of the budget . . . is to say that the latest squeaky wheel gets greased, I think it's a very bad signal to all the other groups who have had either a current or past crisis for their program. They'll say, 'We're not letting go either.' That's one of the reasons I've been a little militant about this."

Stockman's remarks were the second time in as many weeks he has bluntly announced that the administration would resist demands by farmers and farm-state legislators for more federal assistance. In addition, President Reagan's fiscal 1986 budget, submitted to Congress last week, proposes deep cuts in farm price supports.

Agriculture Secretary John R. Block has said that a debt-restructuring program recently announced by the administration should be adequate to "help farmers through their temporary difficulties," but that the administration would oppose further aid.

Stockman was asked whether the administration thinks there is a "national interest" in small farmers. "What's the small farmer?" he responded. "That's a sociological concept. I think it's in the national interest to have a strong and productive agricultural sector and we will have one . . . ."

According to the Agriculture Department, among the 2.4 million farmers in this country, 25,000 have annual sales of over $500,000 and about 640,000 mostly full-time, family farmers have sales between $40,000 and $500,000. There are about 1.7 million farmers with sales under $40,000 a year, many of whom have off-farm income.

Stockman, who last week touched off a furor with his rhetorical blasts at farmers, college presidents and the military retirement system, said he was trying to "tone up the environment" for further cuts in federal spending programs that largely benefit the middle class.

Stockman also said that Congress had approved Reagan's five-year military buildup and was now engaged in an "annual book-keeping squabble" over how much to trim from it without hurting weapons programs. Stockman, who sought deep cuts in military budgets last December but was rebuffed by the president, described that internal administration debate also as a "book-keeping squabble."

If the budget-cutting by Congress falls short of the $50 billion goal, Stockman said, "You go with what you've got." He added that Reagan "will not support one dime of tax increase."