A series of terrorist bombings that shattered the image of this Himalayan kingdom as a Shangri-La has added a deadly new dimension to weeks of political agitation against the government and highlighted opposition among some Nepalese to the country's royal family, according to western and Nepalese sources.

The bombings last month, the first such terrorist attacks here, came as a shock in a country long renowned as a tranquil and tolerant melting pot of eastern religions and cultures, a haven for hippies on the "roof of the world" and an exotic land of living goddesses, yaks and legendary yetis that sometimes seems left behind by the 20th century.

The blasts killed seven persons and wounded more than 20 others within a three-day period in Katmandu and three other cities. Two antimonarchist Nepalese exile groups based in neighboring India claimed responsibility for planting time bombs in the capital that damaged two gates of the royal palace, an entrance to the National Assembly, or parliament, and the lobby of a five-star hotel frequented by foreign tourists.

The government has declined to comment specifically on the claims, but a palace spokesman acknowledged that the bombings were "directed at the crown" and characterized the perpetrators as "a very small lunatic fringe, which is against the monarchy."

The monarchy is believed to enjoy widespread support in this landlocked nation of 16 million people, the world's only Hindu kingdom, and King Birendra Bir Bikram Shah Dev is revered by many of his subjects as an incarnation of the Hindu deity Vishnu. But lately, according to residents, there have been signs of mounting public dissatisfaction with members of the 39-year-old king's family, opposition to the country's institutional ban on political parties and unions and frustration with the government's handling of serious economic problems.

Among the most acute problems, western and Nepalese sources say, are rampant official corruption and the spread of heroin addiction among Nepalese youth. The two problems are seen here as related; social workers say the complicity of high-ranking officials has helped turn Katmandu into a transit point for international heroin trafficking.

While the government up to now has tended to dismiss the drug problem as one limited to foreign hippies who come to partake of Nepal's plentiful hashish, social workers involved in treating addicts estimate that 10,000 to 12,000 of Katmandu's 300,000 inhabitants -- 99 percent of them Nepalese -- are heroin users. In 1978 the number of addicts was estimated at 50.

In a recent newsletter published here, the Rev. Thomas Gafney, an American Jesuit missionary who runs Nepal's only treatment center for drug addiction, said the "hard-drug abusers" in Nepal include college students, military and police personnel, pilots and airline employes, sons and daughters of the well-to-do, as well as poor people and "disaffected and boredom-laden youth." Among those involved in smuggling heroin and opium into the country from Burma via northern India and from Pakistan, Gafney wrote, are merchants, diplomats, professionals and "people claiming membership in royal intelligence and government service."

Gafney's efforts to call attention to Nepal's drug problem apparently have ruffled some feathers in the government, which has refused to extend visas for three Jesuit missionaries, including two social workers involved in his treatment program.

According to western diplomats and Nepalese sources, the alienation that has been a factor in the growth of the drug problem appears to have intensified lately with the suppression of antigovernment protests.

In May, following a teachers' strike to demand recognition of a union, political groups began to agitate for restoration of a multiparty parliamentary system under a constitutional monarchy to replace the 25-year-old "partyless" system instituted by King Birendra's father as little more than an accouterment of direct royal rule.

On May 23 the leaders of the banned Nepali Congress Party and half a dozen outlawed communist factions planned to launch a nonviolent civil disobedience campaign to press their demands, but authorities quickly arrested the leaders and stifled the campaign. By mid-June, according to the Nepali Congress Party, about 6,000 persons had been arrested. The government has denied holding that many prisoners, insisting that no more than 1,500 political activists were jailed at any one time.

Then, on June 20, the day after the king delivered an annual "throne speech" in which he called on Nepalese to resist efforts to sow instability, five explosions rocked Katmandu. One of the blasts killed a national legislator and his aide and another killed three employes, including two receptionists, at the Hotel de l'Annapurna, which is owned by one of the king's relatives. Two explosions at the gates of the palace caused no deaths, mainly because visitors and employes had taken shelter from a monsoon downpour, officials said.

In two other cities on June 19 and 21, a man and a woman were killed by bombs they were carrying, police said. In other incidents, bombs exploded or were discovered and defused in five towns along Nepal's border with India.

According to a palace spokesman, who did not want to be named, police arrested 1,000 suspects after the bombings, about 900 of whom were released later. He said most of the 100 still held were Nepalese who had undergone guerrilla training in India. He said the explosives recovered had been manufactured in India.

The two groups that have claimed responsibility for the blasts reportedly operate camps in India, although no evidence of Indian government involvement in their activities has emerged.

One group, the United Front, is led by Ramraja Prasad Singh, an exiled former member of the Nepalese parliament who was jailed for antimonarchist activities in the 1970s. The other group, the previously unknown United Liberation Forces, is believed to be an offshoot of the United Front with links to Indian communists.

According to informed western sources, Nepalese who have studied in the Soviet Union or have connections to the Soviet Embassy here were among those picked up in the police sweep after the bombings.

The palace spokesman said none of the activists arrested earlier for the civil disobedience campaign was involved in the terrorism. In fact, the day after the bombings, the Nepali Congress Party and the communist groups deplored the blasts and called off their protest campaign.

While the bombings were condemned widely, some longtime residents said they detected sentiment that popular frustration at last had been expressed in a way that might alarm the government into action.

"This shows that people are really fed up," one said. "People feel there's no hope of any change for the better under the present system."

"I think the place is seething with discontent," said Rishikesh Shaha, a former finance and foreign minister. "There is no doubt the rot has set in." Shaha said he still supports the monarchy but wanted King Birendra to end his "rule by peremptory command" and stop corruption emanating from the royal palace.

According to Nepalese and western officials, the main targets of criticism have been the king's two younger brothers, Princes Gyanendra and Dhirendra. In a recent demonstration, a diplomat said, protesters for the first time publicly held up placards asking the king to "get rid of" his two brothers because of perceptions here that they are involved in influence peddling and various shady business deals.

"The middle class is getting more and more fed up with what they see happening at the palace," the diplomat said. "The king seems to work pretty hard at his job, but there's no indication he has made any effort to rein in the abuses around him," said a longtime foreign resident.