President Reagan has sent a message of reassurance to the leaders of the anticommunist guerrillas fighting in Afghanistan as senior U.S. diplomats prepare for talks bearing on the future of Soviet and U.S. involvement in the 8-year-old war.

Reagan's message to Maulavi Yunis Khalis, chairman of the Islamic Alliance of Afghan Mujaheddin, or holy fighters, was described by administration sources as an assurance that the United States will continue and even strengthen its extensive military and political support for the mujaheddin so long as the Soviet Union continues to press its battle in Afghanistan. Reagan made a similar public declaration Nov. 12 after a meeting with Khalis and four other Afghan resistance leaders at the White House.

Undersecretary of State Michael H. Armacost departed for Pakistan yesterday for meetings with officials of that government to coordinate U.S. and Pakistani positions in what appears to be a more intense diplomatic phase of the Afghan struggle.

Armacost, who is accompanied by Robert B. Oakley, Middle East director of the National Security Council staff, has asked to see Khalis and other senior Afghan resistance leaders in Pakistan. It is unclear whether such a meeting will take place, because the initial response was that many of the leaders were involved in the fighting around Khost, where a major Soviet offensive has been in progress to break a rebel siege.

The question of when, and under what conditions, the United States might cease its support for the Afghan resistance is a ticklish political issue in Washington and among the questions to be discussed by Armacost in Pakistan.

The United States agreed more than two years ago to be a "guarantor" of a negotiated settlement under which the Soviet Union pulls out its 115,000 troops; outside interference, such as aid to the resistance, ceases, and the 4 million Afghan refugees in Pakistan and Iran are able to return home.

As the Soviet Union repeats that it has decided to withdraw and has reduced its proposed withdrawal timetable to 12 months "or less," the possibility has increased for such a settlement to be concluded under U.N. auspices by Pakistan and the Soviet-backed Afghanistan government.

Despite repeated demands by the United States and other nations, the Soviets have not set a date for their pullout to begin. Nevertheless, the prospect that they may do so, possibly leading to a negotiated settlement of the war, has lifted details of the negotiations to a high place on the U.S. and Pakistani agenda and raised fears in some quarters about a premature cutoff of U.S. aid to the resistance.

Armacost has said that the administration will insist on seeing all details of a negotiated pullout before undertaking a guarantor role. He and other officials have reiterated Reagan's Nov. 12 statement that "the withdrawal of Soviet forces is the key to resolving the Afghan crisis."

"We're not committed to anything until the whole agreement is set," said a senior State Department official following discussions last week to set up Armacost's mission. "We have not signed anything or initialed anything," he added.

Differences in the administration on the cutoff of aid to the Afghan resistance reflect the hypothetical and uncertain nature of the Soviet pullout conditions that would call for such a U.S. response, the official said. "The government is not very good at handling such hypothetical questions," he said.

U.S. military aid to the Afghan resistance was reported to be about $660 million in fiscal year 1987. The figure budgeted and appropriated this year is well short of that, according to an informed source, but the funds could be augmented later. "There is no shortage of money," an administration official said.

Another major question to be discussed in Pakistan is the prospect for a transitional government in Afghanistan that can run the country during the period of the Soviet withdrawal and perhaps thereafter.

After insisting for many months that the Afghan Communist Party must form the core of such a regime, the Soviets appear to be moving toward acceptance of a much smaller role for the communist Afghans.

At the same time some leaders of the anticommunist Afghan resistance are beginning to shift their positions. Last week, Khalis spoke publicly for the first time of such an interim government, a concept that had not previously been mentioned favorably by the mujaheddin. Administration sources said some resistance leaders have been informally discussing interim-government issues with politically prominent Afghan exiles who are anticommunist.