President Reagan's harsh rhetoric about the House-passed foreign trade bill is justified and then some. It is a scandalously bad bill, with provisions that the president has rightly said will bring trade war, not trade. His unequivocal threat of a veto is good news.

Would that as much could be said for his decision two days earlier to protect the machine tool industry from import competition -- for "national security" reasons. One hears that the pros and cons of this issue were fought over bitterly within the administration. Reagan's compromise, which is no compromise at all, means that the wrong side won.

Our trade legislation has had a national security escape hatch for 30 years. It was enacted in the time of Sam Rayburn and Lyndon Johnson, specifically and, in fact, solely to provide a statutory basis for import quotas on crude oil from Venezuela and the Middle East. Its "contribution" to national security was to hasten the depletion of the oil reservoirs in the Southwest. Until now, no president since Eisenhower has allowed national security to be used as a pretext for restrictions on imports.

Presidents have been reluctant to invoke the national security clause for good reason. Its use, if challenged, would require a plausible explanation of the national security risk attached to particular imports. This would entail a discussion of the kind of wars to be envisaged, their probable length, and so on. Understandably, presidents have been unwilling to speculate publicly on these matters.

Then, too, opening this additional door to tariffs and quotas becomes an invitation to a prospective host of petitioners. The textile industry has observed that our soldiers must be clothed, the footwear industry that they must be shod. It is not easy to imagine a war that did not require steel or copper or any of a thousand products and commodities that we import or might import. And if we can declare anything we choose to be a national security item, what is to prevent others from following suit?

Japan's agricultural policies, about which we justly complain, can be claimed to be necessary to the security of that island nation. The European Community's hated Common Agricultural Policy has brought self sufficiency in food grains. A costly and trade-disruptive policy, but who can say that it does not contribute to European security? Brazil is trying to build a computer industry on the foundation of import barriers, and we are threatening to retaliate. What if they assert in Sa o Paulo that a computer capability is a necessity for Brazilian security?

Reagan has avoided overt reliance on the statutory clause by proposing to have Japan, West Germany, Switzerland and Taiwan -- imagine, if you will, little Taiwan's tool makers threatening the security of the United States -- volunteer to restrict their exports to the levels of 1981. We do not intend, however, to go hat in hand to plead for this indulgence. If volunteering is slow, we will impose the quotas ourselves, presumably on the strength of the threat to national security.

The volunteers may come more or less willingly, or course. A sharp reduction in the volume of imported machines will boost prices in the United States. In truth, that is the very idea and intent of our action. The foreign makers and their political masters may calculate that higher American prices for their exports -- at the cost of reduced volumes -- may make it worthwhile to avoid a hassle with the American government.

Whatever the choice the others make, our government will have taken an unseemly action, contradictory of the fine free trade phrases to which our president subscribed a few weeks ago in Tokyo, and full of potential for mischief. Can we be certain, for instance, that we will have signed up all the potential malefactors capable of selling machine tools to our industries? Our experience with steel and textile quotas should tell us that we will have to close off more and more countries if our market is made more attractive because prices have been raised artificially.

Most important, what will the quotas do for our stodgy machine tool industry? The supposedly coddled Japanese industry, which has provided most of the foreign competition, has in reality been in near constant turmoil, with brand new firms rising to leadership positions and older firms losing place and market share. Are we supposed to believe that quota protection is the way to promote innovation and technological change in America?

Even if a case could be made for import relief for some sectors of the industry, to seize on the national security clause has to be wrong. Early on, the industry's attention could have been directed to the standard escape clause in the trade law. A finding of injury then would have enabled the president to give tariff protection, operative for a limited period, thereby providing to the tool makers the kind of catch-up incentive most likely to work. In allowing matters to go as they have, the administration has bought a mess of troubles and precious little else.

Not even votes. The delegation from a machine tool state, Connecticut, evenly divided between the parties, voted as one last month for the House trade bill.