U.S. producers of a large portion of the nation's major manufacturing equipment yesterday invoked national security in asking the Commerce Department to limit sharply imports of foreign-made machine tools.

The National Machine Tool Builders' Association asked the federal government to slap a quota on imports over a five-year period that would reduce their rapidly expanding share of the market from 27 percent in 1982 to 17 1/2 percent when it goes into effect.

The machine tool manufacturers also asked the Commerce Department to limit the share of imports in each segment of the machine tool market--now as high as 50 percent in some products--to 20 percent of value.

The petition was filed under the portion of U.S. trade laws that allows the president to limit imports when they appear to threaten national security. Few petitions have been filed invoking the clause and few of those filed have been granted, said a Commerce Department spokeswoman. Of 13 cases and one update filed since 1962, only three positive findings have been made--all for petroleum-related products.

Hard hit by both the recession and imports, principally from Japan and Europe, the machine tool manufacturers claimed in their petition that the nation's ability to arm itself in the event of certain types of crises, and the vigor and international leadership of the domestic industry are both endangered by imports.

Statistics about the industry draw a dismal picture. Orders for U.S. machine tools dropped by 24 percent in January from the previous month and were 55 percent below what they were a year before. Four years ago, when the industry was at a peak, orders were more than five times higher.

During this decline, according to industry officials, imports have continued to rise, accounting for a constantly larger share of U.S. sales every year since 1978, particularly in expanding markets such as sales of numerically (computer) controlled machines.

Though a small industry (producing less than a quarter of a percentage point of the gross national product in 1982), the machine tool industry is crucial to the national defense, the petition argued. Machine tools are machines such as lathes, milling machines and boring mills that make parts for other machines, such as automobile and aircraft parts.

"The products and technology of this industry are the essence of the industrial manufacturing process," the manufacturers claimed in a summary of their petition. "They are, by definition, the 'tools' of production. As such, machine tools are needed to produce every ship, plane, tank, missile, transport vehicle and other armament used by our armed forces" as well as essential civilian equipment, the manufacturers argued.

"Machine tools are the seed corn of armament," association President James A. Gray told a national convention of the manufacturers yesterday. The petition, which requires the Commerce secretary to make a recommendation within a year, was timed to coincide with the meeting.

"This downturn is not like any previous cyclical downturn in the history of our industry," Gray said yesterday.

"Unless we do something substantial, the future of our industry is bleak," he said. Noting that a substantial inventory of imported machines is in warehouses in the United States, estimated from 5,000 to 10,000 machines, he speculated that those machines might be sold at discount prices when the market begins to improve.

"The result could act as a knockout punch," he said.