In the two years since the launching of a U.S.-backed campaign against local cocaine trafficking, this regional capital has been shocked into a recession, besieged by leftist rebels, terrorized by mass slayings and occupied by the Army.

These last few months, however, the cocaine business has been better than ever.

"It's incredible," said Maj. Javier Marius, the deputy commander of a U.S.-funded antinarcotics police force. "There's so much trafficking that the whole town is dealing in dollars. It's like it was before we even started."

Tingo Maria has become a showcase of the Reagan administration's troubles in curbing the flow of cocaine from South America to the United States. In what was meant to be a model program, the United States committed about $30 million to an array of eradication, development and enforcement projects here and in the surrounding 540 square miles of the Upper Huallaga valley.

The idea was to eliminate 35,000 acres of coca plants, cocaine's raw material, and help thousands of small farmers switch to other crops. The hope was that Peru, which produces nearly half of the world's cocaine, would slowly be weaned of a business worth at least $500 million annually.

But this ambitious campaign has been paralyzed by problems common to drug enforcement efforts: violence, mismanagement, corruption and resistance from the public and local authorities.

Leftist rebels moving into the region have been able to exploit deep local resentment of the narcotics programs and security forces, project officials say. The rebels, in turn, have attracted the Army, which took control of the valley five months ago under a state of emergency, grounded the U.S.-backed police forces and refused to take responsibility for drug enforcement.

A month ago, officials suspended eradication operations after 19 workers were attacked and killed, presumably by narcotics traffickers. Development aid projects also have been scaled back for security reasons.

"The situation is dramatic because the narcotics traffic has substantially increased," said Ramon Cornejo, executive director of Peru's aid project in the Upper Huallaga, which is backed by an $18.5 million U.S. grant. "We have simply not had the proper coordination in the zone."

Despite the program's current paralysis, U.S. and Peruvian officials say the aid and enforcement work recorded some gains in the first two years. Nearly 8,500 acres of coca plants were eradicated by police and 300 Peruvian contract workers during 1983 and 1984. Peruvian aid officials said agricultural extension projects have increased farming acreage devoted to traditional crops such as rice and cacao in the past year, while technical help has doubled productivity on some model farms.

All along, however, the antidrug programs have had to contend with what officials now say is a nearly insuperable economic barrier: while honest farmers can make a modest living with traditional crops in the jungle valley, growers and traffickers of coca plants can quickly and easily become rich.

According to enforcement sources, the sale price of a kilogram (2.2 pounds) of coca leaves has quadrupled this year, to $120 or more. Migrant farm workers are paid less than $3 a day to work in rice fields but can make $16 a day picking coca.

The wealth brought by this drug industry is conspicuous in Tingo Maria and the dozens of small farm communities around it. Streets are choked with imported trucks and motorcycles in a town of ramshackle construction and only one paved road. Peasant farmers furnish huts of wood and palm leaves with elaborate battery-powered stereo systems and imported furniture. In Tocache, a tiny town north of Tingo Maria, an auto dealer recently reported selling 27 vehicles on a Sunday afternoon.

"People in this area came out to get rich on the narcotics trade," said Cornejo. "They can't conceive of the world without coca. There is no crop that could possiby replace it economically, so they don't want to hear about anything that has to do with substitution or development."

While the Upper Huallaga's estimated 14,000 small coca farmers have thus strongly resisted the eradication and crop substitution programs, officials here concede that their work has been further stymied by poor coordination and interagency rivalries. Eradication teams, funded and guided by the State Department's Narcotics Assistance Unit, have focused much work on small farmers whose acidic fields are unsuitable for any other crop; as a result, 70 percent of farmers affected by the raids have rejected the aid program meant to provide them with alternatve incomes.

The Peruvian agricultural experts and U.S. Agency for International Development officials working on the crop substitution program, meanwhile, have resisted direct identification with the enforcement efforts and focused their assistance on larger farmers on the valley floor -- whether or not they have given up coca. Peruvian aid workers in Tingo Maria conceded that they sometimes assisted farmers with rice crops even as the farmers continued to grow coca bushes in adjacent fields.

The U.S.-trained police strike force has had a similarly mixed record. While its officers claim to have significantly reduced cocaine traffic up until late this year -- provoking a noticeable economic depression in the valley -- its members have been widely accused of abuses and corruption, ranging from the extortion of bribes from farmers and traffickers to rapes and killings.

The former mayor of Tingo Maria, Tito Jaime Fernandez, repeatedly denounced alleged abuses by the force on local radio and in reports to the central government. He was assassinated last April by unknown assailants.

With local resentment to the drug programs at a height early this year, rebels of the Maoist Sendero Luminoso group began infiltrating the Upper Huallaga region from traditional bases in the southern mountain range, according to official sources. Promising in their propaganda to wage a "popular war" against the U.S.-trained force, the rebels recruited dozens of local residents and in June began a series of attacks against police stations, the strike force and offices and camps of the aid and eradication programs.

The offensive prompted President Fernando Belaunde to declare a state of emergency in the Upper Huallaga region in late July, and several weeks later, Army units moved into the area and assumed military and political control.

Virtually the first act of the Army was to order the U.S.-trained force to cease antinarcotics operations. According to official sources, the force remained inactive until last month, when the Army ordered a detachment of 100 men to pursue rebels based in the mountains west of the valley. The drug force spent nearly three weeks pursuing them, although conditions of its U.S. funding technically bar it from such tasks.

Meanwhile, a group of men believed to be linked to narcotics trafficking broke into a camp of eradication workers in the town of Cornilla on Nov. 17 and shot 15 to death. That night a topographer and three assistants working with the eradication program were killed at another site. U.S. and Peruvan officials then decided to suspend the program until the police force could resume security operations.

Army officials say they halted the police antinarcotics work because it was necessary to focus operations on the rebels. These officials now say they believe most of the rebels have left the Upper Huallaga, but they say they remain unwilling to allow the U.S.-trained force to operate or act against narcotics trafficking.

"We have to have popular support to fight terrorism," said one Army official, who spoke on the condition he not be named. "We have to be a friend to the population. You can't do that by eradicating coca."

That position has increasingly frustrated U.S. and police officials, who say coca cultivation and trafficking has boomed since the Army took control. However, U.S. diplomatic pressure has so far failed to get permission for the strike force to resume work.