Nicaraguan leader Daniel Ortega wound up an official visit here tonight after receiving a pledge of Soviet economic assistance for his beleaguered country and an equally explicit Soviet endorsement of Nicaragua's efforts to normalize relations with the United States.

Diplomatic sources here said that the somewhat vaguely worded communique lays the basis for closer Soviet-Nicaraguan cooperation.

However, these sources said, it also makes clear that Moscow does not expect Nicaragua to turn into another Cuba and that the expansion of Soviet involvement in Nicaragua could come about only if the Reagan administration should continue an unyielding hostility toward the Sandinista government in Managua.

There was no indication that the Nicaraguans intended to abandon their domestic socialist development, and the communique emphasized that both sides intended to "broaden and deepen" relations between the Soviet Communist Party and the ruling Nicaraguan Sandinista party.

But the communique spoke of Moscow's "resolute solidarity" with Nicaragua's efforts to pursue its political objectives, a phrase considerably weaker than the expression of "full support" that the Soviets voice for Nicaragua's "concrete peace proposals" aimed at normalizing the situation in Central America. In this context both sides also "highly assessed" recent initiatives by the Mexican government to resolve conflicts in that region.

The communique, distributed by the official news agency Tass, said Soviet President Leonid Brezhnev was invited by Ortega to pay an official visit to Nicaragua and this was accepted "with gratitude." No date for a visit was set.

During Ortega's six-day visit, the two countries signed an agreement on economic and technical cooperation, including several separate protocols. The Soviet Union promised to deliver unspecified "machinery and equipment" to Nicaragua and to assist it in "the development of the hydropower and mining industries, agriculture, communications and other branches of the Nicaraguan economy."

Latin diplomats said earlier that they believed Ortega, who heads Nicaragua's three-man junta, also was interested in acquiring Soviet military equipment. They specifically mentioned Soviet aircraft, armored vehicles and patrol boats.

No mention was made of any military assistance in the communique, which was worded cautiously, apparently because of the current developments in Latin America and the Falkland Islands.

A Latin diplomat who closely followed the visit said that "the key to Nicaragua's future policies is in Washington. Quite clearly, the Russians do not want another Cuba with the economic drain it poses on Soviet resources. It is equally clear that the Nicaraguans would prefer to deal with Washington, but they could not do so if the price is their abandonment of socialist policies."

Observers saw the principal importance of the visit as one of having cemented closer party relations. Ortega was treated here as the head of a "fraternal country" with the entire Soviet leadership attending a Kremlin dinner in his honor.

The communique said the talks here were conducted in an atmosphere of "cordiality and complete mutual understanding," a phrase suggesting a high level of agreement on matters discussed.

The document cited as a matter of "particular danger" the alleged large-scale American military preparations for interference in internal affairs of Central American countries. Both sides "strongly demanded that the United States discontinue threats against Nicaragua, Cuba and other nations in Central America and the Caribbean."

They also denounced U.S. involvement in El Salvador and called for "a political solution through negotiations" in that country. The Soviets also endorsed Nicaragua's nonaligned foreign policy while Nicaragua backed Soviet foreign policy.