The Reagan administration, asserting that the government of El Salvador still needs help to resist leftist guerillas, officially announced yesterday that it is sending $25 million in new military aid and 20 U.S. military training advisers to that strife-torn Central American country.

The decision, which had been expected for more than two weeks, was announced last night by State Department spokesman William Dyess. He said the current level of U.S. security aid is not enough to enable Salvadoran authorities to cope with potential new threats from the guerillas, who the United States contends have been supplied with massive amounts of weapons by Cuba and other communist countries.

According to Dyess, four training teams of five men each will be sent to El Salvador to instruct the military forces there in combat techniques, intelligence and the use and maintenance of U.S-supplied equipment. Their presence, added to the 25 American training personnel already in El Salvador or en route there, will bring the total to 45.

But, in an obvious bid to assuage concern that the United States might be heading toward a repeat of its involvement in Vietnam, Dyess stressed that the U.S. personnel will not be "combat advisers" who accompany Salvadoran forces on missions. The Americans, he said, will remain in garrisons and will not be allowed into combat zones, although they will carry sidearms and be able to protect themselves if attacked.

Although Dyess described the new equipment being provided only in general terms, reliable sources said it will consist of four Huey helicopters, large amounts of machine guns, mortars, rifles and ammunition, heavy-duty trucks and communications and surveillance equipment.

Announcment of the aid increase came as Secretary of State Alexander M. Haig Jr. revealed that the administration has given Nicaragua, through whose territory the arms allegedly are being smuggled to the insurgents, a 30-day deadline to cut off the weapons flow. Otherwise, Haig said in a meeting with reporters, Nicaragua's leftist-dominated government faces a final cutoff of the U.S. economic aid that has helped keep it financially afloat.

Haig said Nicaragua has provided "certain assurances" that it is making a maximum effort to comply but that it is too early to say whether this will be successful. Although he gave no dates, State Department sources said the deadline was set in mid-February and will run out the middle of this month.

According to Haig, officials here realize it will be "a complex decision" to determine formally if Nicaragua has ceased to support the guerrillas in neighboring El Salvador through shipments of arms, training of insurgents, radio propaganda and other means. While Haig said the United States has sufficient intelligence capability to determine if the arms flow is stopped, he also noted that land and sea shipments are more difficult to monitor than are aircraft flights and radio broadcasts.

In its move to make El Salvador a testing ground for President Reagan's policy of challenging aid by the Soviet Union and other communist governments to Third World insurgency movements, the administration has been aware that it is courting controversy because of the comparisons to Vietnam and charges that El Salvador's military-civilian government is the captive of repressive right-wing forces.

These points were addressed carefully and at length by Dyess in his announcement last night. He asserted the administration's belief that the Salvadoran government is committed to democratic reform, and he charged that the leftist guerrillas are the main threat seeking to divert the government from its reformist path. He also said the administration anticipates increasing the current level of $63 million in U.S. economic aid to El Salvador to help achieve reforms.

Dyess also said the decision to increase security assistance had been made after consultations with leaders of Congress. He added that the administration had concluded the actions it is taking do not require the formal consultations and reporting to Congress specified by the War Powers Act.

Similarly, Dyess said, the increased aid, which will come under the current fiscal 1981 budget, will be achieved by reprogramming existing credits for military sales or drawing upon existing Pentagon equipment stockpiles, and thus will not require new appropriations from Congress.

Still, the administration's decision immediately touched off stirrings of opposition. Forty-four members of the House, headed by Rep. Richard L. Ottinger (D-N.Y.), sent a telegram to Reagan protesting that the move will increase the risk of deeper U.S. involvement in the Salvadoran conflict and calling for formal consultations with Congress under the War Powers Act.

In what is likely to foreshadow the reaction in many domestic liberal and human rights, circles, the Americans for Democratic Action last night called the administration's decision "both morally wrong and a grave strategic blunder" that "will further implicate the United States with a government that has virtually no popular support. . . ."

Announcement of the 20 new military personnel came on the heels of a weekend statement that the administration was following up on a Carter administration decision to send six naval advisers to El Salvador. Dyess said yesterday the aid increases also will mean increasing the military personnel assigned to the U.S. Embassy in El Salvador from four to nine, thereby bringing the number of American servicemen who soon will be serving there to 54.