NEW DELHI, India (AP) _ In a bid to avert a new confrontation with Sikhs in Punjab, the Indian government Thursday ordered a judicial investigation into the anti-Sikh riots that followed the killing of Prime Minister Indira Gandhi.

It also agreed to lift the ban on a militant Sikh students' union and to release some Sikhs arrested in Punjab on suspicion of seditious activity.

Home Minister Shankarrao B. Chavan announced the moves in Parliament two days before the threatened start of new agitation by Sikhs seeking greater self-government in Punjab.

The government wants to head off new demonstrations and violence in agriculturally rich Punjab, where Sikhs form a slight majority over Hindus.

The leader of the Sikhs' Akali Dal party, Harchand Singh Longowal, termed the decisions ''belated'' but said party leaders would discuss them Friday at a meeting in the Sikh holy city of Amritsar.

''This has paved the ground for negotiations between the government and the Akalis,'' predicted Kuldip Nayar, a prominent Indian columnist, who met with Longowal on Wednesday.

Chavan said a Supreme Court judge would head the inquiry into ''organized violence'' that followed Mrs. Gandhi's Oct. 31 slaying - by two Sikh security guards, according to the government.

More than 2,700 people, mostly Sikhs, were beaten and burned to death during four days of rioting by Hindu mobs.

The Akalis said leaders of the ruling Congress Party planned and executed the violence, and made a judicial probe their most urgent demand. Several newspapers and independent civil liberties groups made the same allegation.

Mrs. Gandhi's son and successor, Prime Minister Rajiv Gandhi, had refused to order an investigation, saying it would open ''old wounds.'' Later he said he would consider one as part of a ''package settlement'' with the Akalis.

Some Hindu political leaders demanded a judicial inquiry also into the killings of hundreds of Hindus by Sikh terrorists in Punjab in recent years.

''We want a comprehensive inquiry going into all the violence in Punjab since 1978,'' Atal Bihari Vajpayee, president of the pro-Hindu Bharatiya Janata (Indian People's) Party, said Thursday.

Chavan announced lifting of a ban on the All-India Sikh Students' Federation, which was outlawed a year ago following intelligence reports it was recruiting a guerrilla army to fight for a separate Sikh state.

The union reportedly had close links with Jarnail Singh Bhindranwale, the extremist leader killed in the army assault on the Golden Temple, the Sikhs' holiest shrine, in Amritsar last June.Mrs. Gandhi ordered the army to drive out hundreds of heavily armed Sikh militants. About 800 Sikhs and 200 soldiers were reported killed in the battle.

Chavan said the government decided to release some of the more than 800 Sikhs jailed in Punjab as extremists. Most are held under the National Security Act, which allows detention for up to a year without trial.

Longowal and seven other Akali leaders were released last month.

Longowal threatened to launch a new anti-government crusade on Saturday unless party demands are met.

The Akalis' other main demand is acceptance of the 1973 Anandpur resolution which the party says calls for greater autonomy. The government claims it advocates a separate Sikh state.

Saturday is the start of Baisakhi, a harvest festival that marks the formation of the Sikhs into a warrior sect in the late 17th century.

District officials in Amritsar on Thursday ordered a ban on meetings, demonstrations and the public assembly of more than five people ''to ensure peace and order'' during Baisakhi celebrations.

A similar order was issued in New Delhi's main commercial district.