Construction of a new U.S. Embassy here was halted Monday when about 300 Soviet workers walked off their jobs after U.S. security officials used a new machine designed to discover listening devices implanted in the buildings.

U.S. officials disclosed the walkout today, saying that the Soviet construction workers abandoned the sprawling $120 million project in central Moscow to protest the use of the machine. The officials described it as an X-ray device used for checking structural flaws in the buildings.

Well informed U.S. sources said the new device was "designed to sweep the walls before they are sealed" to make sure that no Soviet listening devices had been implanted.

The device had been cleared by Soviet authorities earlier, presumably as one normally used to check on possible cracks in concrete construction works. The sources suggested that Soviet officials ordered the walkout after they began to suspect that the machine had a different function.

According to embassy officials, work on the new buildings was halted when four Soviet women supervisors, wearing red armbands to suggest they were deputized for police duty, prevented workers from entering the fenced site by arguing that the use of the new machine exposed them to health hazards.

An embassy spokesman, Rick Ruth, described the incident as a dispute about terms of the contract. "As far as we are concerned," he said, "there are no health hazards at the site."

Ruth, however, refused to provide other details on grounds that the U.S. government did not want to prejudice any potential court battles with the Soviet Union.

Asked about the discrepancy between the embassy's official position and private accounts of the source of Soviet anger, Ambassador Arthur Hartman said with a smile, "It is a contract dispute. Our contract gives us the right to inspect, and that's what we were doing."

American building supervisors said the new machine was to be used on the site for another four weeks and that they did not expect the Soviet workers to return to their jobs before June 20, when the X-ray inspection is to be completed.

The construction site is almost directly behind the current U.S. Embassy compound, whose 10-story chancery building was found to have been heavily bugged when it was occupied in 1952.

The walkout was the most recent snag to delay the project since the two countries signed an agreement on building their new embassies more than a decade ago. After protracted haggling over the terms, a final agreement was signed at the 1979 Vienna summit between Leonid Brezhnev and Jimmy Carter.

The new Soviet Embassy compound on upper Wisconsin Avenue in Washington was largely completed two years ago when Soviet personnel moved into their housing facilities.

Although the cornerstone for the new American Embassy here was laid in 1979, the project is only about 30 percent complete and is not expected to be finished until late 1985 at the earliest, according to U.S. construction specialists here. Its estimated cost of $100 million has risen by 20 percent since 1979.

The project includes an eight-story chancery building, originally slated for completion this year, an elementary school building, sports and other recreational facilities and housing for 134 families.

Americans here have complained frequently about difficulties with Soviet workers. Under the agreement the United States is not allowed to import foreign workers to do the job. It is allowed to have about 40 supervisors on the site.

The 900-by-450-foot complex is surrounded by a wire-mesh fence and lit by floodlights, presumably to prevent clandestine installation of listening devices.

Other precautions include transparent pipes within sections of the chancery building to allow security personnel to monitor possible use of the pipes by the Russians to sneak in bugging devices. The site was almost deserted today, and several U.S. construction supervisors were reported to be planning to depart for the United States for the duration of the shutdown, which came just as work was accelerated to take advantage of the mild summer weather. For most of the year, Moscow's harsh climate allows for only a single shift.