The White House announced yesterday that a compromise had been reached between three Jewish organizations and a business group on long-troubling aspects of legislation designed to prevent involvement of U.S. businesses in foreign boycotts.

President Carter endorsed the agreement between the Business Roundtable and the Anti-Defamation League, the American Jewish Congress and the American Jewish Committee.

The need for anti boycott legislation was triggered by the demands of Arab countries that U.S. companies join in a boycott of Israel or lose their business.

"In my view," said Carter in a statement, "one of the most gratifying aspects of the agreement is its reasonable balance between the need for stringent controls over the undesirable impact on Americans of foreign boycotts and the need to allow continuation of American business relations with countries engaged in such boycotts."

The House has already passed an anti-boycott bill, and the Senate is considering a slightly tougher measure approved by the Senate Banking Committee.

Sen. Adlai E. Stevenson (D-Ill.), who sponsored the legislation but who has expressed reservations about some of its thornier aspects, has agreed to support the modifications suggested by the Jewish-business conferees.

The Roundtable, an organization of 170 U.S. business executives, and the Jewish groups backed the broad language in the legislation that, among other things, prohibits all forms of religious or ethnic discrimination arising out of a foreign boycott and prohibits U.S. companies from acting as enforcers for foreign boycotts.

The compromise came over the formerly divisive issue of "unilateral selection."

The phrase refers to the right of a foreign nation to instruct a U.S. contractor on which subcontractors or suppliers he may use.

Under the compromise, the language of the Senate bill would be softened to be more like the House bill and allow unilateral selection. This means, according to a Stevenson aide, "when a U.S. company in Saudi Arabia places an order for products with Ajax Co. in the U.S., it can tell Ajax that it will accept A, B or C as subcontractors, but not D," possibly because "D" does business with Israel.

Presumably, "D" would be offensive to the Saudi Arabians who might cancel the whole contract if "D" is involved.

This clearly was an amendment favored by U.S. business. Another amendment in the compromise was pushed by the Jewish negotiators. It involved a section of the Senate bill allowing the President to permit a U.S. company in a boycotting country to comply with the laws of that country.

The compromise would allow such compliance only with "laws or regulations of that foreign country governing imports . . . of trademarked, tradenamed or similarly specifically identifiable products or components . . ."

The Roundtable-Jewish meetings have been going on since January. The two groups were brought together by Irving S. Shapiro, chairman of E. I duPont de Nemours & Co., who is also chairman of the Roundtable.

Shapiro, who describes himself as a "businessman who also supports Israel," said he organized the meetings because "I was afraid that all the emotion would do Israel more harm than good."

The Roundtable team was made up of three lawyers from DuPont, General Electric Co. and Citicorp. The three Jewish groups were each represented by Washington attorneys.

Negotiations broke down during the heated debate over the Senate bill, but the sides got together again after the House passed its version of the legislation.