House and Senate conferees agreed Thursday on portions of a compromise trade bill that includes a provision to punish the Toshiba Corp. for its subsidiary's illegal sale of high-tech strategic machine tools to the Soviet Union.

The punishment, added in the Senate as an amendment offered by Sen. Jake Garn, R-Utah, would bar Toshiba Machine Tools from selling its goods in the United States for three years and would bar the U.S. government from buying other Toshiba goods for a year.The equipment sold to the Soviet Union will allow it to mill submarine propellers that are significantly quieter and virtually undetectable to those trying to track them.

Garn said he is pleased with the compromise, which narrowed the effect of his original amendment, but in his words "sends a message to companies around the world that if you violate export control laws you will be punished."

But Japan criticized Congress, since the Japanese administration and courts have already taken what they consider adequate steps to punish the company and assure future violations are prevented.

"It is deplorable that the U.S. government is planning to impose sanctions . . . in addition to the punishment Japan administered," said Hajime Tamura, minister for International Trade and Industry.

"It is very deplorable that the U.S. Congress is going to pass a trade bill with sanctions against a foreign company," said Prime Minister Noboru Takeshita's spokesman, Keizo Obuchi. "We will ask President Reagan to veto the bill."

Garn said he was embarrassed "that a Republican administration that is so deeply concerned about national security would be opposed to this action."