LAUSANNE, SWITZERLAND, AUG. 20 -- Switzerland's supreme court today ruled that records of Swiss bank accounts used by participants in the Iran-contra affair may be handed over to U.S. investigators.

The decision, reached after a two-hour hearing, meant that accounts controlled by former major general Richard V. Secord, his business partner, Iranian-born businessman Albert A. Hakim, and arms dealer Manucher Ghorbanifar could be opened for inspection by U.S. Justice Department authorities. The three had been named in requests made by the Justice Department to Swiss authorities late last year and early in 1987, but opening of their accounts was delayed when they initiated the appeals procedure, which ended today.

Independent counsel Lawrence E. Walsh said in a statement in Washington that he was pleased that the Swiss court had "reaffirmed our right . . . to receive the evidence located in Switzerland."

Walsh said that both the Geneva magistrate and the Swiss federal office for police matters had provided assurances that they would now proceed "expeditiously" to give access to the records.

The Swiss court's action clears the way for Walsh's investigators to see the detailed records of the accounts into which proceeds from the Iran arms sales and donations from U.S. citizens and foundations flowed.

The congressional Iran-contra panels were able to trace much of the money generated by the arms sales to Iran through Swiss financial records provided by Hakim. However, in the absence of the official bank records, the committees have had no way of ascertaining whether these records are accurate or complete.

Credit Suisse, the bank that had held the disputed accounts, had always said it would turn them over to Swiss authorities if legal procedures here were observed. U.S. sources said the bank had turned over all records of the accounts involved to Geneva magistrate Vladimir Stemberger several weeks ago.

The accounts were among several set up in 1985 and 1986 by Secord, Hakim, Ghorbanifar, Lt. Col. Oliver L. North and a number of intermediaries.

Justice Department sources said that once the bank records are turned over to the United States, Switzerland would consider its involvement in the Iran-contra gate affair ended.

"We have done what the Americans asked us, now it is up to them to use the information we have given them," an official said after the supreme court ruling today.Washington Post staff writer Dan Morgan in Washington contributed to this story.