Defense Secretary Caspar W. Weinberger kicked off a three-day visit to Central America today by calling the U.S. military effort here "a vital part of our defense of the continental United States."

Weinberger, who is scheduled to become the first defense secretary to visit El Salvador and Honduras and who is the highest-ranking Reagan administration official to visit this region, also said the primary U.S. goal in the region is to provide a safe climate for private investment in order to help eliminate "some of the terrible poverty."

"As far as I'm concerned, the only way in which that's ever going to be ended is to get a situation in which there's some job-producing investment and some foreign exchange-producing investment," Weinberger said as he traveled here from Washington aboard an Air Force jet. "That investment can only really be made if the investors are persuaded that it is a secure place."

Weinberger this afternoon slogged through the mud to watch soldiers practice jungle warfare, sampled yucca and other "jungle food" and toured the Army's military school for members of Latin American armed forces. About 9,400 U.S. military people are stationed in Panama.

The main events of his visit, however, are scheduled for Wednesday and Thursday in El Salvador and Honduras, where he plans to visit many of the military installations now taking shape as part of the recent and controversial U.S.-supported arms buildup in the region.

He plans to inspect Salvadoran soldiers' pacification efforts in their country and to visit a Green Beret training camp in Honduras where Salvadoran soldiers are learning to fight leftist insurgents.

Weinberger said he believes the U.S.-supported government in El Salvador has been having "very much greater success" combating leftist guerrillas during the past two or three months. He said weekend attacks by guerrilla forces in San Miguel, which some officials speculated might signal the beginning of a leftist offensive, "do not seem to be a sustained drive."

Weinberger said his visit, in the company of Assistant Secretary of State Langhorne A. (Tony) Motley, indicates the importance of the region. The United States has begun a month-long series of war games in Honduras that involve thousands of troops and scores of Navy ships and planes off both Central American coasts.

"It is one of our most important commands, and we have a substantial number of troops on the maneuver and training mission," Weinberger said. "And it's a vital part of our interest and a vital part of our defense of the continental United States."

Weinberger declined to say whether his discussions with Salvadoran officials will touch on human rights violations by right wing death squads, which have been linked in some reports to members of the armed forces. But he indicated that the threat to human rights from the left is greater in any case.

"There are death squads on the guerrilla side, and there's a great deal of total lack of human rights on the guerrilla side," he said.

Any improvement in human rights or economic conditions, he added, would be "totally impossible under the kind of revolutionary tactics that have been exported, first into Cuba, then into Nicaragua, and from those countries have been attempted to be exported elsewhere."

Weinberger commended the peace-making efforts of roving Ambassador Richard B. Stone, who has arranged discussions between the Salvadoran government and the insurgents.

However, he said the guerrillas continue to insist on a share of power before elections are held, a demand which he called "quite obviously not acceptable" to the Salvadoran or U.S. governments.