The Senate voted unanimously yesterday to embargo all imports from Iran in response to reports that U.S. purchases of Iranian oil soared over the summer, fueling Tehran's economy just as the United States was attempting to curb its attacks on shipping in the Persian Gulf.

The embargo was approved, 98 to 0, as the Senate struggled to resolve its own bitter dispute over U.S. tanker escorts in the gulf and pass a long-delayed defense authorization bill for the fiscal year starting at 12:01 a.m. Thursday.

The embargo was added to the defense bill at the urging of Senate Minority Leader Robert J. Dole (R-Kan.), who acknowledged it would be difficult to enforce but called it a necessary gesture of American resolve to stop "subsidizing the ayatollah's reckless policies and provocative actions."

Noting a report in Monday editions of The Washington Post that U.S. imports of Iranian oil totaled $700 million last summer, making Iran America's second-largest supplier of crude oil, Dole said, "It's absurd. It's ridiculous. It's hard to believe . . . . It's time to end this absurdity."

The vote was largely symbolic because the defense bill appears headed for a presidential veto, even if it can surmount remaining hurdles in Congress, including Senate Republican filibuster threats.

President Reagan has threatened to veto the measure because of constraints on testing of his Strategic Defense Initiative (SDI) that have been approved by the Senate and House. He has also vowed a veto if the Senate approves a pending proposal from Democratic leaders for limits on the U.S. tanker-escort operation in the Persian Gulf.

But Dole, an undeclared candidate for the 1988 Republican presidential nomination, said the Senate vote could help the Reagan administration win support from the United Nations for sanctions against Iran if it continues to reject a cease-fire in its war with Iraq.

Dole also said he would not be surprised if the administration acted soon on its own to impose an import embargo.

Under Dole's proposal, the import embargo would become effective upon enactment unless the president certifies in a report to Congress that the cutoff is "not in the overall interest of the United States." Such a finding could delay the embargo for only 180 days, however. After 180 days, the embargo would take effect unless the delay were extended by Congress.

The new embargo proposal goes beyond one adopted last July by the Senate, as part of its trade bill, to impose an embargo if U.S. ships, personnel or property come under military or terrorist attack from any Persian Gulf nation. The ban, while directed primarily at oil, encompasses all Iranian goods, including heavily exported pistachio nuts and rugs.

Dole acknowledged the argument that Iran could escape damage from a U.S. embargo by selling its oil elsewhere but said it was important for the United States to take a stand anyway. "We cannot stand silently by," he said. To do so would "send to the Ayatollah {Ruhollah Khomeini} a message of uncertainty that only invites further reckless behavior that has been characteristic of his erratic reign," he added.

Rejecting the argument that Iran might be more influenced by the threat of an embargo than by an embargo itself, Dole said, "We've had enough warning shots across the bow. Now is the time for some tough action."

White House spokesman Marlin Fitzwater, asked to comment on Dole's amendment, said, "We are certainly sympathetic to its purposes and are generally supportive, but we need to analyze its specific impacts before stating a formal position."

Senate Majority Leader Robert C. Byrd (D-W.Va.) joined Dole as a principal cosponsor of the proposal, and Sen. Alan J. Dixon (D-Ill.) said it would send a "significant message" to Iran.

The Senate's speedy action on the import embargo contrasted with its continuing partisan deadlock over the last two issues to be resolved in connection with the $303 billion defense bill for fiscal 1988: limits on the Persian Gulf operation and provisions to compel compliance with weapons limits in the unratified SALT II strategic arms limitation treaty.

Both have been proposed by Democrats over opposition from GOP leaders, who were reluctant to agree to a vote on either issue, hoping to force the Democrats to drop the provisions.

As the Senate cleared away other amendments to the defense bill, Democrats and Republicans were mulling a possible compromise under which the SALT II proposal would be considered part of the defense bill and the Persian Gulf issue would be taken up as separate legislation after passage of the defense measure.

Meanwhile, the Democratic Study Group in the House urged the Senate to drop its Persian Gulf proposal on grounds it could undermine prospects for future presidential compliance with the 1973 War Powers Resolution and jeopardize a lawsuit that the study group has filed to compel Reagan to comply with the law.

Reagan has refused to invoke the war-powers law. In proposing separate legislation aimed specifically at the escort operation, Senate Democrats stopped short of trying to invoke the 1973 law, saying it could jeopardize all military activities in the Persian Gulf. But the study group, composed of moderate-to-liberal House Democrats, said the War Powers Resolution could be invoked just to cover the escort operation.