Bisweswar Prasad Koirala, 68, the prime minister of Nepal during its only period of democratic government and the principal leader of its opposition, died here Wednesday. He had cancer.

Mr. Koirala participated in the struggle led by Mahatma Gandhi for the independence of India from Britain. He spent his later years advocating democracy in his Himalayan homeland. He survived repeated political setbacks, including dismissal from office and 18 years in Indian and Nepalese jails.

His death occurred shortly after his return here from Bangkok, Thailand, where he had gone for medical treatment. More than 1,000 supporters turned out to greet him on his return to the Nepalese capital.

Although he was its strongest opponent, the government had awarded the dying politician $15,000 to help pay for his treatment. In 1977, the government paid all of his expenses for a trip to the United States for medical treatment.

Mr. Koirala was Nepal's prime minister in 1959 and 1960. He and his cabinet were arrested when the late King Mahendra ended the experiment in democracy in December 1960. Mr. Koirala was jailed without trial until 1968, when he was allowed to go into exile in India.

He returned to Nepal in 1976 and was arrested immediately on charges of treason and sedition. A special tribunal acquitted him of treason while the sedition charge eventually was allowed to lapse.

In 1979, widespread political agitation throughout Nepal led King Birendra, who succeeded to the throne in 1972, to hold a national referendum on the restoration of political parties, which had been banned since January 1961. A royal proclamation permitted greater freedom of speech, press and assembly for the referendum campaign period.

Mr. Koirala, although already in poor health, returned to the public platform for the first time since 1960 and campaigned vigorously in favor of a multiparty system. But the referendum vote went against him and he refused to take part in elections while continuing to press for democratic reforms.

He made his last public speech in Kathmandu last January, advocating a policy of reconciliation between the crown and what he called the democratic forces in Nepal.

His brother, Girja Prasad Koirala, said their outlawed political party, the Nepali Congress Party, would continue the reconciliation policy but might adopt some new tactics, including the nonviolent strike where appropriate.

In addition to his brother, Mr. Koirala is survived by his wife, three sons and a daughter.