TOKYO, JULY 1 -- The two top officers of Toshiba Corp. resigned today, taking responsibility for a subsidiary's sale of high-tech machinery to Moscow that helped the Soviets build quieter submarines.

Chairman Shoichi Saba and President Sugiichiro Watari announced their decisions at a news conference hours after the U.S. Senate voted to bar imports of Toshiba products for two to five years. Saba said they would become consultants to the company.

News of the Senate action caused Toshiba shares to fall 24 yen (16 cents) today on the Tokyo Stock Exchange, to 680 ($4.66). The ban must be approved by the House and President Reagan to take effect.

Toshiba's sales in the United States were estimated at $4 billion last year, including $344.8 million worth of semiconductors. Other products include color televisions, video recorders and personal computers.

"We have a big responsibility as the parent company," Saba said. "We feel responsible for having troubled society."

He said Toshiba Corp. had "nothing directly to do" with the sales by its Toshiba Machine subsidiary and denied that the resignations resulted from the Senate action. However, he said stepping down was "appropriate."

The two executives "feel gravely responsible for straining the already strained Japan-U.S. relations further," he said.

Toshiba Machine is accused of selling eight sophisticated milling machines to the Soviet Union in 1982-1984 in violation of Japanese trade rules that prohibit exports to communist countries of 178 strategic high-tech items. The rules conform with those of the Coordinating Committee for Export Control based in Paris.

U.S. officials say the machinery helped the Soviets fashion much quieter propellers for their submarines, thus making them harder to track.

Kongsberg Vaapenfabrikk, a Norwegian company, also was penalized under the Senate bill because of its role in the sales, which amounted to $17 million.

In Oslo, the company's marketing director, Jens Charles With, refused to comment on the Senate's action, saying: "We're taking a wait-and-see attitude until the Congress and the U.S. administration have handled the affair."

Norway's foreign minister, Thorvald Stoltenberg, said that "sanctions and compensation claims are out of place in an allied partnership."

"Our government has clearly expressed that U.S.-Norwegian relations can suffer if Senate-proposed sanctions are finally adopted," he told a news conference.

The U.S. State Department also expressed concern about the Senate action, saying it is "inappropriate for the United States government to seek compensation for actions of private firms in other countries."

Saba said he and Watari had considered resigning for some time, but the official decision was not announced until an emergency board meeting today.

A special committee to investigate the illegal sales will include representatives of Toshiba Machine and Price Waterhouse, an American accounting company that audits Toshiba's finances, Saba said.

President Kazuo Iimura and three other top officials of Toshiba Machine already had resigned to take responsibility for the sales. Toshiba Corp. owns 50.8 percent of Toshiba Machine.