The Reagan administration's plans for a rapid military buildup could be stalled in crucial areas because the American machine-tool industry is struggling to cope with growing foreign competition and has become leery of dealing with the Defense Department, industry leaders said yesterday.

"The resiliency and vigor of the private U.S. industrial base was the major secret weapon of World War II, Korea and Vietnam," said Richard P. Bodine, president of Bodine Corp., a small machine-tool firm in Bridgeport, Conn.

The conversions from consumer-related to defense-related production made during those three conflicts could not be made now, said Bodine.

He and other industry executives said the machine-tool industry -- the companies that produce equipment that cuts, drills and shapes metal -- is under financial stress despite the recent surge in orders from auto, aircraft, and energy companies.

Appearing before the House Banking subcommittee on economic stabilization, the company officials pressed their campaign for faster depreciation of new machine tools and for other tax changes to improve the industry's cash flow and profitability.

Ralph E. Cross, chairman of Cross & Trecker Corp., cited the advancing age of machine tools in the U.S. as evidence of the industry's vulnerability to foreign competition. Only 31 percent of the American stock is less than 10 years old compared with 61 percent in Japan.

According to a House Armed Services Committee study, 60 percent of the machine tools used in defense production are more than 20 years old.

"Technology has not stood still while our machines have leisurely aged. Far from it," Cross said. The technology of industrial robots and computer-guided manufacturing systems is growing at a tremendous rate -- but not in defense industry plants, he said.

In adition, many of the best firms in the industry no longer will do business with the defense department, said Cross. "The harassment is unbelieveable," he contended.

Bodine's firm is an example. In World War II, its automatic drilling and tapping machines were used to produce artillery and bomb fuses. In the Korean war, the plant again was converted to defense-related production.

By the time of the Vietnam war, the company had entered the risky venture of producing sophisticated automatic assembly machines -- which again were supplied to the defense industry to produce fuses for bombs and artillery shells.

Now, said Bodine, his company no longer bids on defense contracts.

Rather than deal with the government regulations, from affirmative action to pension policy, the company decided in 1972 to avoid all such rules it could legally duck, he said. Equally troubling were the government contracting procedures, which required the firm to bear financial risks without a compensating profit, he said.