President Reagan said yesterday Congress will make a "great mistake" if it puts any time limit on commitment of U.S. forces to the Persian Gulf, as Senate Democratic leaders struggled over how far to go in challenging the administration on the issue.

But the White House, challenging Congress, opposed any restrictions on presidential action and asserted that portions of the 1973 War Powers Resolution are unconstitutional.

A senior official said that "there is a necessity for the president to exercise his powers in the current situation, and we think the public understands that."

Reagan's comment came during a photo-taking session where he was asked about published reports that Congress wants to limit U.S. military presence in the gulf to 90 days. The president said that any congressional restrictions would "simply be an encouragement" for Iran to wait until the time limit expired before taking action.

White House spokesman Marlin Fitzwater said the administration is "meeting the spirit of the {War Powers} resolution through extensive briefings with Congress." He added, however, that there is no need to report the U.S. attack on an Iranian vessel accused of laying mines in the gulf because it was "defensive."

"In addition, we continue to believe that parts of the resolution are unconstitutional and usurp executive branch prerogatives," Fitzwater said.

Congress is torn by conflicting pressures, including divisions over the constitutionality of the War Powers Resolution and its applicability to the Persian Gulf. There is mounting apprehension over deepening U.S. involvement in an open-ended war and yet reluctance to tie the president's hand in conducting it.

"As a matter of history . . . Congress doesn't have the guts to fulfill its own obligations" under the war-powers law, said Sen. Lowell P. Weicker Jr. (R-Conn.) in opposing efforts to resolve the dispute without invoking the law's requirement for congressional approval of U.S. involvement in long-term hostilities.

In daylong meetings off the Senate floor, Senate Democratic leaders attempted to work out a bipartisan proposal that would put some limits on the tanker-escort operation without triggering specific provisions of the war-powers law.

They alternated between mild and strong language in a series of drafts, winding up the day with consideration of a proposal that could require a presidential request, and acquiescence of Congress, for continuation of the operation after 90 days from enactment.

But a final draft is not expected to be submitted to the Senate until tonight.

The administration has repeatedly refused to invoke the War Powers Resolution, which provides for notification of Congress when hostilities are "imminent." U.S. forces must then be withdrawn within a specified time unless their continued presence is authorized by Congress.

Fitzwater asserted yesterday that hostilities are even less "imminent" than before the U.S. attack on the Iranian vessel, which killed three Iranian sailors and provoked threats of retaliation.

"I would make an argument that the major threat in the gulf today is mining, and that catching people mining and preventing these mines from going into the water diminishes the threat," Fitzwater said.

Like other presidents before him, Reagan has made no secret of his view that the War Powers Resolution unduly restricts his actions. But until now, in the gulf situation, administration officials have limited themselves to saying that the law does not apply in current circumstances.

A senior official said that there is "less reluctance" to openly criticize the legislation now because "it is clear that the public doesn't want the Congress directing operations in the Persian Gulf." He said polls taken for the White House support this view.

The Senate voted, 50 to 41, last week to reject a proposal that would have invoked the War Powers Resolution. But the new outbreak of hostilities Monday prompted a renewed push for congressional action, which Senate Majority Leader Robert C. Byrd (D-W.Va.) sought to temper with a compromise that would pass with Republican as well as Democratic support.

At one point yesterday, the group, which included Sen. John W. Warner (R-Va.), ranking Republican on the Armed Services Committee, moved toward a proposal that would have done little more than require a report from Reagan on progress of the escort operation and remind the president of Congress' control over spending.

But advocates of congressional limitations, including Sens. Dale Bumpers (D-Ark.) and Brock Adams (D-Wash.) pressed for stronger constraints, and Weicker and Sen. Mark O. Hatfield (R-Ore.), who did not participate in the negotiations, continued to demand that the War Powers Resolution be invoked.

Congress should either obey the law or "get rid of it," Weicker said. "To flout it is the worst of all alternatives."

Accusing Democrats of dodging their responsibilities as the opposition party, he said, "I think they would rather be hide in the weeds and wait for Reagan to stumble than to challenge him" and take the consequences.

The War Powers Resolution has been eroded by executive and congressional inaction over the years, and failure to invoke it now would come close to putting the "final nail in the coffin" for the statute, Weicker said.