Defense ministers of the North Atlantic Treaty Organization agreed yesterday at their meeting in Brussels to buy 18 American-built early warning aircraft at a total cost of $1.8 billion.

The United States will pay the major part of the bill, 42 percent, West Germany will contribute 31 percent and Canada 10 percent. The other NATO partners will make up the rest.

The British contribution will be in the form of 11 Nimrod early warning aircraft to patrol the oceans around NATO countries, leaving the land surveillance to the Boeing 707s stuffed with electronic gear for that purpose.

The idea of deploying the aircraft -- known as AWACS for airborne warning and control system -- is to provide warning of Soviet attacks by land or sea. The planes have look-down radar for spotting low-flying aircraft or missiles.

The first Boeing AWACS will be deployed in 1982 and the whole fleet of 18 is scheduled to be in position by 1985. Their home base will be Geilenkirchen, West Germany.

The British Nimrods will patrol the seas from bases in Britain.

One question the Pentagon faces is whether to add money to its $2.2 billion fiscal 1979 request to go to Congress in January to finance the U.S. AWACS contribution or handle it within the fiscal 1980 budget now in preparation.