The Reagan administration reacted with shock and dismay yesterday to the assassination of Indian Prime Minister Indira Gandhi, which came only a few weeks after President Reagan ordered a more forthcoming U.S. attitude toward India in an attempt to improve bilateral relations.

In a secret National Security Council directive several weeks ago, according to official sources, Reagan authorized new bilateral discussions with India in an attempt to break a logjam over sales of American high technology with potential military application.

A U.S. team headed by State Department officials is expected to visit New Delhi, probably this month, to begin these talks.

The directive grew out of an interagency study started last June, about the time of the Indian Army raid in Amritsar on the the Sikh minority's holy Golden Temple. The bloody incident deepened U.S. concern about India's stability and about relations between India and Pakistan. The passion generated among Sikhs by the raid and associated events led to Gandhi's assassination.

Administration sources were cautious in predicting a future course for India, the Subcontinent and U.S.-Indian relations, largely because of uncertainty about the political power and personal strength of her successor and son, Rajiv. Officials described the new prime minister as an unknown quantity whose brief political life has been in his mother's shadow.

For example, Rajiv Gandhi made it known that he wanted to attend the Los Angeles Olympic Games last summer, an official said, but his mother reportedly said no.

A "spasm of violence" of unknown dimensions is likely in the immediate future as followers of the slain prime minister seek retribution on the Sikhs, according to official estimates. For this reason, the State Department issued a travel advisory shortly after receiving news of the slaying, telling Americans "to consider deferring their travel to India until the situation becomes clearer" and recommending caution on the part of Americans already there.

Secretary of State George P. Shultz is to head a U.S. delegation to Gandhi's funeral in New Delhi Saturday, the White House announced. Vice President Bush, who might have headed such a delegation under normal circumstances, opted to fulfill campaign commitments in the final weekend before the U.S. presidential election.

Reagan, expressing "shock, revulsion and grief" over the assassination, joined Shultz in a visit here to the Indian Embassy, where they expressed condolences to Indian Ambassador K. Shankar Bajpai.

U.S.-Indian relations were often tense during Gandhi's rule but seemed to improve after her visit to Washington in 1982. She was accompanied by Rajiv, who sat on the sidelines and said little.

By all accounts, Reagan and Gandhi got along well personally. Their last exchange, in early September, was prompted by U.S. refusal to permit hijackers of an Indian Airlines plane to come here from Dubai as they had requested. Gandhi wrote Reagan in appreciation for this decision, according to White House officials.

The president, in reply, is reported to have written that the international community, working together, can halt terrorist acts. Reagan referred to this exchange in a statement yesterday, saying, "Her senseless murder serves as a vivid reminder of the terrorist threat we all confront."

Sen. Orrin G. Hatch (R-Utah), who urged in a Senate speech May 19 that the United States develop an "India card" to woo New Delhi from its close relationship with the Soviet Union, commented in the wake of the assassination that "this is the time for us to do what we can to arrange a better relationship."

Hatch said Gandhi's visit here and Shultz's visit to New Delhi in June 1983 have "laid the groundwork for a new U.S.-Indian strategic relationship" and that he detected "some movement" in recent months to build on that foundation.

The visit of U.S. warships to the southern Indian port of Cochin last February and to Bombay in May were the first such port calls in India for 13 years and were seen by some as a symbol of improving military relations.

In mid-July, Gen. A.S. Vaidya, chief of staff of the Indian Armed Forces, made an official visit to Washington. In late September, students and staff of the Indian National Defense College visited the Pentagon and U.S. bases and were received by Bush.

The most serious limiting factor in U.S. relations with India has been Washington's relations with India's neighbor, rival and recurrent foe, Pakistan. The Reagan administration has expanded relations with Pakistan, including a $3.2 billion U.S. military aid program, generating Indian protest.

In mid-September, the State Department expressed concern about "a temporary cooling in Indo-Pakistani relations," including low-level clashes along the cease-fire line in Kashmir and cancellation of talks.

The statement was issued after a leak of U.S. intelligence reports that India was considering a strike at Pakistani nuclear facilities.

Another problem for the United States has been India's treaty of friendship and other ties with the Soviets. Some in and outside of the administration consider India untrustworthy because of this, while others urge efforts to woo India and limit the Soviet tie.

To a great degree, India has been peripheral to U.S. strategic planning. This is symbolized by the boundary of the Pentagon's Central Command, established in 1983 to enhance U.S. readiness in a broad swath of the Middle East and Africa. The command includes Pakistan but ends at its border with India.