The United States should turn over its effort to protect Persian Gulf shipping to a United Nations peacekeeping force, two former U.S. Cabinet secretaries told Congress yesterday.

Former secretary of state Cyrus R. Vance and former secretary of defense Elliot L. Richardson said the U.S. naval presence had failed to curb attacks on international shipping since the United States began reflagging and escorting 11 Kuwaiti tankers in July.

"The task requires a high degree of multilateral cooperation, engendered by a sense of common purpose," Vance, secretary of state in the Carter administration, told the Senate Foreign Relations Committee.

Under the Vance-Richardson proposal, the U.N. Security Council would create a seagoing United Nations peacekeeping force to flag, inspect and escort commercial vessels in the Persian Gulf.

The force, drawn from countries other than the United States and the Soviet Union, would consist of seven armed, U.N.-crewed patrol boats, under orders of 10 U.N. military observers. It would be financed through user charges levied on the flagged vessels or by voluntary contributions.

The proposal calls for U.N. personnel to inspect commercial ships entering the gulf to make sure they are not carrying military material.

After passing inspection, the ships would carry a U.N. flag, two U.N. observers and, in some cases, be escorted by a U.N. patrol boat.

Any state or group interfering with safe passage of a U.N.-flagged vessel could face Security Council sanctions, according to the proposal.

Defense Secretary Caspar W. Weinberger has voiced opposition, saying peacekeeping forces can work only after a cease-fire has been reached in the seven-year-old Iran-Iraq war.