There has been one notable exception to President Reagan's efforts to ease government out of American life: the steady infiltration of the Defense Department into U.S. factories and laboratories.

The longest sustained military buildup in U.S. peacetime history has sent money cascading through the U.S. economy. In 1984, the Defense Department signed $146 billion in prime contracts, compared with $32 billion 10 years earlier.

The biggest winners, not surprisingly, have been the top 25 defense contractors, who pull in more than half of the Pentagon's dollars and more than three-quarters of its research funds. Every major aerospace company except Boeing now depends primarily on government sales.

But the Pentagon's reach extends far beyond the traditional arms merchants. The top 100 Pentagon contractors include 12 oil companies and two universities -- Johns Hopkins and Massachusetts Institute of Technology. And the Pentagon shops not only for grenades ($180 million in 1984) and submarines ($1.6 billion), but movie cameras ($25 million), nuts and washers ($15 million), toilet paper ($14 million), coffee, tea and cocoa ($57 million), flags and pennants ($5 million) and yarn and thread ($507,000).

The Pentagon will spend $40 billion on defense electronics this year, $10 billion more than consumers will spend on electronics products, according to a securities firm that tracks the industry. Those defense electronics sales are expected to reach $100 billion a year by 1990.

The National Science Foundation predicted recently that the buildup would lead to an acute shortage of aeronautical engineers in coming years. By 1987, the agency said, 15 percent of engineers will be supporting the arms industry.

By and large, though, the predicted bottlenecks in skilled labor and rare materials haven't materialized. Experts say some of the warnings were always spurious, coming from opponents of the buildup. In addition, they say, the recession, an increase in imports to satisfy consumer demands and the ill health of the commercial aircraft and shipbuilding industries reduced competition for some resources.

The crunch may not have hit yet, however, because the "bow wave" of arms spending has not crested. Defense companies have record backlogs of unfilled orders, just as the Pentagon has a record balance of unspent funds.

And government spending on research and development, which has shifted from half military to more than 80 percent military in the past five years, almost guarantees that the Pentagon will shape the future for American business.

The potential profits have lured some giant companies from outside the defense world. General Motors, for example, reportedly is looking for arms companies to buy.

At the same time, some of the largest defense companies are seeking to diversify by plunging into such commercial fields as data processing, Wall Street analysts say.

As Laurence Lytton of Drexel Burnham Lambert Inc. observed, "The Disneyland world of defense may not go on forever."