The Reagan administration plans to provide $4 million openly in nonlethal aid to refugees and rebels in Afghanistan this fiscal year, a senior State Department official said yesterday.

It is the first time the administration has proposed open aid for the Afghan rebels, although covert Afghan aid is thought to be the largest secret U.S. assistance program.

Congress must be informed of the expenditure, and could block it through a joint resolution. However, key legislators have been pushing for even more aid. William Schneider Jr., undersecretary of state for security assistance, told a congressional hearing that the new funds will be shifted from unspent funds in about two weeks, and will "go through" refugee camps in Pakistan. He noted that "the refugees are also insurgents."

Another State Department official said the funds would "assist those who remain within Afghanistan but have been adversely affected by the course of the war" against occupying Soviet troops.

The administration has already supplied $300 million in humanitarian aid to refugees in camps along the Pakistan-Afghan border, but this is the first to be openly sent to forces inside Afghanistan.

"Modalities of how this aid would get to them have yet to be worked out," the official said.

The Federation for American Afghan Action, a group backing the rebels, estimates that the rebels have received $380 million to $400 million in covert U.S. aid through the CIA since the Soviet invasion in 1979, most of it through Pakistan. Another $250 million is expected this year, it said.

But Pakistan has been trying to maintain at least the appearance of neutrality to allow it to push for a Soviet withdrawal and a nonaligned Afghan government.

Schneider's disclosure is likely to upset Pakistani President Mohammed Zia ul-Haq, who was warned recently by Soviet leader Mikhail Gorbachev that further "aggressive actions" by Pakistan "cannot but affect in the most negative way Soviet-Pakistan relations."

Efforts for comment from the Pakistani Embassy were unavailing last night.

Schneider said after the hearing that the aid could include trucks and ambulances as well as food and medicine, and he indicated that any effort by Congress to increase the amount would be welcome.

Sen. Gordon J. Humphrey (R-N.H.) has proposed a $10 million humanitarian aid package, and the administration has already asked for $6 million for fiscal 1986.

Schneider earlier told the hearing of the Senate Appropriations subcommittee on foreign operations -- called to consider criteria for U.S. aid to insurgent groups worldwide -- that the United States "must retain the freedom to put would-be totalitarians on the defensive" by aiding resistance groups.

Schneider said groups must be chosen and aid given on a case-by-case basis, but stressed that "totalitarian regimes . . . cannot assume they are immune at home so they may do as they wish abroad."

Sen. Dennis DeConcini (D-Ariz.) and Rep. Stephen J. Solarz (D-N.Y.) pressed for a policy that also would aid groups fighting repressive rightist governments.

Solarz, who sponsored legislation to aid noncommunist resistance forces against the Vietnamese occupiers of Cambodia, suggested that U.S. aid should be given only to indigenous efforts to drive out foreign occupiers when the group has broad U.S. and international support and when U.S. aid would enhance prospects for a negotiated settlement and advance significant U.S. objectives.

Assistant Defense Secretary Richard L. Armitage added that aid must be accompanied by economic, political and military reform efforts and should be reliably supplied over several years.

Subcommittee Chairman Robert W. Kasten Jr. (R-Wis.) quoted Secretary of State George P. Shultz as launching the debate by writing in the current issue of Foreign Affairs magazine about "a long and noble tradition" of backing democratic struggle. "If we turn our backs on this tradition, we would be conceding the Soviet notion that communist revolutions are irreversible while everything else is up for grabs," Shultz wrote.