In the uncertain aftermath of a failed coup 19 years ago, a precocious 26-year-old, Abdou Diouf, was fired from a coveted governorship after refusing, on principle, to swear a fealty oath to the man who later became his political mentor, Leopold Sedar Senghor, Senegal's first and recently retired president.

It is a poetic irony that Diouf, who came to Senghor's attention because of his dismissal, should today be halfway through his first year as Senegal's second president after being groomed for the position by Senghor himself.

Senegal is alone in black Africa in having the leader who brought the country to independence retire voluntarily and hand over power to a constitutional successor. In a similar peaceful transition three years ago, Kenyan President Daniel arap Moi took over as the East African country's leader after the sudden death of Jomo Kenyatta.

As happened when Moi took power, political pundits here openly wondered if Diouf would be as adroit as his strong-willed predecessor in maintaining domestic political stability. Diouf, who had labored unobtrusively for a decade as prime minister in Senghor's shadow, was unknown to the average Senegalese.

The two men's personalities were a study in contrast. Senghor, 75 when he handed over power last December, is remembered as the diminutive, gregarious, intellectual poet-president and Catholic Francophile who governed a country whose 6 million people are 80 percent Moslem. Diouf, 45, who has never run for election, towers at 6 feet 8 inches tall, and has a reputation as a hard-working, honest bureaucrat. He was a top Koranic scholar in his youth as well as a college scholarship winner and graduate of the University of Paris. He is well known for an aloof and formal manner on all occasions.

Diouf has swiftly made some deft and popular political moves by defusing a potentially disruptive teachers' strike, lifting restrictions on political activity and forgiving thousands of dollars worth of debts owned to the government by peasants. But Diouf came into power with the heavy burden of being intimately associated with a decade of economic deterioration, mismanagement and pervasive corruption.

Senegal has also been plagued for the past seven years by erratic rainfall, which has substantially reduced production of peanuts, a major revenue earner. While Senghor and Diouf have talked about economic reforms for the past two years, none has yet been implemented except for the dismantling of the mismanaged National Peanut Marketing Board.

Without being specific, Diouf recently charged that his own dominant Socialist Party was guilty of "opportunism, corruption and trafficking in influence," ills he said his administration intends to eradicate.

"When [Diouf] first came into office, many people were worried that he was not firm enough and too selfeffacing to be able to make the type of difficult decisions that have to be made for Senegal's [economic] future," commented a well-informed Western diplomat.

"Today the mood is different," the diplomat added. "He has shown some flair that people did not know he had and made some smart political moves."

A year ago, Senghor had moved in a heavy-handed way to dismiss dozens of teachers after they threatened not to grade exams to protest a series of grievances shared by many students and other adults.

After taking office in January, Diouf set up a meeting with the teachers' union, education officals and members of his party. Compromises were reached on most of the issues, 59 of the dismissed teachers were recently reinstated and the crisis, for now, has passed.

Diouf has also pushed through the National Assembly, controlled by his Socialist Party, a constitutional amendment abolishing the restriction that limited political activity to four parties. The political liberalization was cheered by Diouf's critics and supporters alike, and six new parties have been formed.

Facing his first election in 1983, Diouf already has begun campaiging. Unlike Senghor, Diouf speaks Senegal's lingua franca -- Wolof -- and has excited rural crowds by doing so publicly and touring the countryside wearing traditional robes. He also has been personally calling on each of Senegal's powerful marabouts or Moslem holy men. It was through the marabouts, and the government patronage he extended to them, that Senghor was able to muster majority support for the Socialist Party.

Diouf's astute political moves have given him a breathing space, but he faces severe economic problems in the near future. Economic conditions for the country's peasant farmers, who make up 70 percent of the labor force, have seriously deteriorated over the past year, damaging their ability to feed themselves and to buy toold for cash crop production.

In a study conducted by the U.S. Agency for International Development and the Senegalese government, food development experts predicted that this pro-Western government could not be self-sufficient in all areas of food production until the year 2010 and then only with massive amounts of financial aid.

Last fall's peanut harvest fell from a normal 800,000 tons to 200,000 tons. Last year, France rescued Senegal from defaulting on a pavment of its huge $1.3 billion foreign debt with an emergency loan of $105 million.

The debt repayment "crunch will come again this year about August or September," said one financial expert. "They don't have the money to pay this year's payment either, and they're again looking to France and the conservative Arah states, like Saudi Arabia and Kuwait, to bail them out," he added.

Diouf has been so busy building up his own political constituency and putting out "emergency brushfires" that he has not had time to implement badly need financial reforms, such as ditching most of the country's 90-odd money-losing state enterprises, the economist said.

"What Diouf needs is a good rainy season this year and a good peanut crop," he added. "That'll give him some room and time to maneuver."