Five months after he turned back an attempted military coup, Prime Minister Prem Tinsulanond is coming under renewed challenge, this time from a civilian adversary determined to unseat him by democratic means.

A landslide victory by former prime minister Kriangsak Chomanan in a provincial by-election last month for a seat in Thailand's parliament has added to the domestic and economic pressures on Gen. Prem's drifting government, which has failed to consolidate its power following the abortive April 1 coup by young Army officers.

Like the coup attempt, the election of the 64-year-old retired general to Thailand's House of Representatives has stirred up the issue of the royal family's role in politics.

In addition, Kriangsak's comeback has highlighted a longstanding question here: whether a way can be found to stabilize the country's chaotic politics and stop its revolving-door coups.

Kriangsak's declared intention in returning to politics a year and a half after he was forced to resign as prime minister is to revive "the democratic process" through an invigorated parliamentary system.

"It's time to make democracy in Thailand a continuing process," he said in an interview. "I pray we should start the democratic process now, because I consider it will save the country and the institutions of monarchy and religion."

Kriangsak's critics, however, contend his only political goal is recapturing power.

"He's not going to do anything," said Kukrit Pramoj, another former prime minister whose Social Action Party bitterly contested Kriangsak in the recent by-election. "He merely wants to become prime minister in the future."

Kriangsak acknowledges he intends to seek the office in Thailand's next general elections, scheduled for April 1983.

In the meantime, Kriangsak is trying to build up his newly founded National Democracy Party and broaden his support in the 301-member House of Representatives.

Having a large, well-organized political party as a power base could become the major factor in future Thai politics when a new law on political parties takes effect following amendments to the Constitution. The law will require groups to have a nationwide organization with membership exceeding certain minimum standards to qualify as legal political parties. The aim is to limit the number of parties and eliminate splinter groups

Kriangsak "is trying to get in a position so that when the political parties law goes into effect, he will be able to form a major party," a Western diplomat said.

Although the bill was passed by parliament in June and has military approval, it could be obviated by another coup, which some Thai politicians consider inevitable.

"A coup will happen again," former prime minister Kukrit said nonchalantly. "If I were American or English I would be horrified by the prospect of a coup," he added, "but, being Thai, it couldn't concern me less." The 70-year-old Kukrit said a military coup was merely "a Thai way of having a presidential election."

Although that prospect apparently does not bother some Thai politicians jaded by four successful military coups in the last decade, it does worry other Thai and foreign observers because of what they see as a dangerous precedent set during the April 1 attempt. Then, the highly revered royal family shunned the past practice of avoiding an overt political role and came down firmly on the side of Prem's countercoup.

King Bhumibol Adulyadej's consort, Queen Sirikit, issued appeals for the surrender of troops under the coup leader, Gen. Sant Chitpatima, and the takeover bid collapsed after a few days.

"The royal family is gradually taking a more active role than it did several years ago," said a diplomatic observer. But they must feel, as many do, that having committed themselves as they did in the last coup, "in the next one the coup-makers will have to neutralize the royal family in some way. This is a new departure," he added.

According to Kriangsak, it is precisely this prospect that worries him. To avoid any future threat to the popular institution that serves as the country's main unifying force, the largely ceremonial monarchy should not be so closely identified with the present administration, he says.

"The monarchy is above politics, and we'd like to keep it that way," Kriangsak said.

Some Thai observers view Kriangsak's comeback as an indirect challenge to the royal family. They note that he resigned under mounting economic pressures last year at the king's suggestion and that he is unpopular with the queen.

In any case, the close identification between the royal family and Prem's government has its defenders.

"Sometimes the monarchy has to stoop to solve political problems," Kukrit said. "You can't blame it for that. The monarchy has the responsibility to preserve the country."

As for Prem, his government currently retains the confidence of the royal family, but does not appear to be making much headway against the economic problems and political factionalism confronting it.

These problems, which transcend the personality conflicts in Thai politics, stem largely from the inefficiency and indecisiveness of Prem's administration, which has not been able to come to grips with soaring inflation and a crime wave that has included the murders of two members of parliament.