Racing against time in the solitude of the Negev Desert, American contractors and nearly 2,000 laborers from Thailand and Portugal are working feverishly to build two mammoth air bases that are part of the $800 million cost to the United States of peace between Egypt and Israel.

At both sites -- here and at the new Ramon Air base about 60 miles northwest along the Sinai border -- giant earthmovers are scraping 10,000-foot-long runways and the bulldozers are burrowing underground bunkers in an almost frantic effort to complete the project by April 25, 1982.

That is when Egypt is scheduled to regain control of the last slice of the Sinai Desert and when Israel will have to abandon two big airfields it built in territory captured during the 1967 Six-Day War.

When the Ovda and Ramon bases are completed, the Israeli Air force will fly its supersonic fighters all of the 25 miles across the new international boundary to the new complexes, and Egypt will move into the Etzion and Eitam airfields that Israel surrenders.

If anyone should be indiscreet enough to ask why Israel did not build its base just inside the pre-1967 border in the first place -- or why the Egyptian-Sinai border could not be adjusted 25 miles in the interest of saving $800 million -- Israeli Air Force Brig. Gen. Moshe Bar-Tov, Israel's construction coordinator here, has a ready answer:

"Obviously, the border could have been altered. But, I remind you that you are in the Middle East, and you have to remember you are dealing with emotional and not rational thinking."

In order to complete a job that normally might take five years in just half that time, the U.S. Air Force and the U.S. Army Corps of Engineers has launched what U.S. Brig. Gen. Paul Hartung this week termed "fast track" construction, meaning that designing the base, procuring materials for it and constructing it are all being done simultaneously in a dizzying process that only makes sense with the help of computers.

Since construction began in October, American engineers have set up at each base whole cities of prefabricated houses imported from Houston, Tex., into which are moving the Thai and Portuguese laborers and another 700 American and British supervisors and specialists at each site.

There are currently 1,200 workers at Ovda, but the labor force will peak at about 2,200 in a few months.

The 6,000-acre site here has already been ringed by a security fence, service roads have been cut through the desert and a deep canal has been dug around the base to divert the flash floods that occasionally occur. Facilities for the workers include air-conditioned bungalows, separate dining halls for laborers and supervisors, recreation halls, a bank, sports field and two swimming pools under construction.

Thais were picked for the job, according to U.S. Air Force Col. Richard Curl, area project manager, because "they are industrious, hard-working and have experience in this sort of thing," a reference to U.S. air bases built in Thailand before and during the Vietnam War.

One of the workers, Paul Kittipont, 31, of Bangkok, called the work a "lifetime opportunity" at which the average Thai worker can earn $800 monthly and, because all subsistence expenses are paid, bank virtually all of it or send it to relatives.

Likewise, Portugal has long exported labor, especially to northern Europe, and the remittances of workers abroad are an important traditional source of the country's hard currency reserves.

The laborers work six 10-hour days a week, and on Sundays often are bused to Eilat on the Gulf of Aqaba for recreation. Carl said the workers are "usually too tired to live it up much," but that any workers who violate base rules can lose their job contracts.

When the construction agreement was originally signed, Israel insisted that only foreign labor be purchased abroad, so as not to exacerbate inflation and drain the Israeli work force. But since then, unemployment in Israel has grown to 10,000, and officials said 200 Israelis will be employed at Ramon.

Israeli suppliers are being allowed to offer bids of $100 million in the next half year.

In addition to contributing $240 million to the total $1.04 billion cost of the two airfields, Israel will build a third base in the Negev.

Bar-Tov conceded that the Sinai Etzion and Eitam bases are strategically more advantageous to Israel because of the vast airspace surrounding them and the availability of limitless firing ranges.

Also, he said, "in case there is any trouble with the Egyptians, we will have to be more on the alert because the border is closer."

But, Bar-Tov acknowledged, "these bases [Ovda and Ramon] will be better equipped, because we have new technology and we have had time to learn from our mistakes."