The Soviet Union accused the Reagan administration today of engaging in an act of "overt lawlessness and dangerous arbitrariness" recently when it instructed American warships to hail and trail a commercial Soviet vessel carrying cargo for Nicaragua.

A Soviet government note described the July 30 incident as "provocative" and said that "the U.S. government should clearly realize that full responsibility for possible consequences of such actions will rest entirely with the American side."

The government news agency Tass said the protest note was given to the U.S. Embassy here.

An embassy spokesman confirmed that the note was delivered today but refused to disclose any other details.

It was the first mention here of the incident involving the Soviet freighter Alexandr Ulyanov, which was encountered by the U.S. destroyer Lynde McCormick about 55 miles off the Pacific coast of Nicaragua. According to U.S. spokesmen, the Soviet ship was asked to identify itself, describe its cargo and give its destination. The Alexandr Ulyanov subsequently was trailed for more than two hours by the U.S. destroyer at a distance of 2,000 yards.

In Washington, State Department spokesman John Hughes acknowledged receiving a Soviet complaint but avoided calling the note a protest. Hughes said the actions of the U.S. destroyer "were in no way provocative or in violation of international law." At no time did the American destroyer threaten to use force, or interfere with the safety or navigation of the Soviet ship, he said.

Tass quoted the Soviet note as saying the Soviet ship, "on a routine commercial voyage in the Pacific," became a "target of provocative actions" by three American warships. Tass identified the U.S. vessels as the destroyers Nos. 8 and 991 and the frigate No. 1066.

It said a helicopter based on one of the U.S. destroyers "made flights above the Soviet ship . . . ."

Four days before the incident, President Reagan asserted that the Ulyanov was carrying helicopters and military equipment for the Sandinista regime in Nicaragua. Nicaragua said the ship was loaded with agricultural and road-building machinery and medical supplies.

Western diplomats said the Soviet note was unusually restrained given the seriousness of the incident. Moscow's long delay in responding was also interpreted as an indication that the Soviets are shying away from a confrontation with the United States in an area far from the Soviet Union.

Some military specialists, however, would not exclude the possibility that Moscow would send warships to escort its commercial vessels destined for Nicaragua. These specialists pointed to a Soviet-American agreement covering incidents at sea that outlines actions for the warships of each nation near warships of the other's.

While the agreement does not appear to cover commercial vessels, it does prohibit warships from training guns on each other or engaging in harassment or dangerous maneuvers, including overflights.

Today's Soviet protest appeared to have been prompted not so much by the incident involving the Ulyanov, but rather by reports from Washington quoting senior officials as saying that every Soviet commercial vessel entering the waters off Central America would be met by U.S. warships.