Fifteen months after taking office, Indian Prime Minister Morarji Desai has met the first major challenge to his power by demanding and getting the resignation of two Cabinet ministers.

While the challenge came from within the ruling Janata Party it was Indira Gandhi, as usual, who was at the center of the controversy even though she no longer holds office.

Home Minister Charan Singh resinged yesterday with a blast charging Desai's government with strengthening "the fascist and corrupt forces which have undermined India's freedom and democracy."

"There is a rising tide of popular anger and resentment among party workers against . . . inaction, drift and betrayal," said Health and Family Planning Minister Raj Narain in his resignation statement.

The two had kept up a drumbeat of criticism of top party and government figures in recent weeks over what they charge is a lack of will to move quickly and forcefully to prosecute Gandhi for her alleged excesses during the 19-months of emergency rule she declared as prime minister.

A commission of inquiry reported in May, after six months of public hearings, that Gandhi had misused her position as prime minister and had subverted legal principals during the emergency.

Since then, Desai has moved slowly and with great deliberation toward the next step - possible prosecution of the former prime minister. Gandhi has made a political resurgency lately and Desai apparently wants to make sure he has a tight case before risking what would be a politically sensitive trial.

On his return June 17 from his trip to the United States, Desai said a decision would be taken within two months.

Singh, who is ill with heart trouble, and Narain apparently wanted to move faster.Narain began taking their case to the public with increasingly intense attacks on the party leadership.

Desai, whose leadership has not been noted for firmness, finally had enough, according to observers of Indian politics. He got the backing of the rest of the Cabinet and the parliamentary leadership and demanded that the two resign.

Behind the political drama in New Delhi is a history of personal fueds and conflicting political ambitions that were submerged in the drive to oust Gandhi from power.

It has been no secret that Singh, the leader of a center-right grouping of small local landholders in northern India, wanted to become prime minister should anything happen to Desai, 82.

"He and Narain were trying to bully the rest of the leadership by using the Gandhi issue," one Washington analyst noted yesterday. "It apparently has backfired."

Four junior ministers resigned along with Narain and Singh, but reports from New Delhi indicate that they will take only about half of the 25-30 votes they had controlled in Parliament.

Janata, an alliance of five parties, holds 299 of the 542 seats in the lower house of Parliament, so its hold on power appears to be in no immediate danger.

As a symbol of a small class of peasant-landholders, Singh had been unbending from the outset in his outspoken hatred of Gandhi and of the socialist programs she supported that had made life for him and his supporters difficult for years.

Defense Minister Jagjivan Ram, who - as leader of the country's Untouchables - is an implicable foe of Singh, is being mentioned as a candidate for the powerful Home Ministry, which controls police.

Chandra Shekar, the Janata party president and a target for attacks by Singh and Narain, is seen as a possible replacement for Narain in the Cabinet.