BOGOTA -- At a time when Colombia is experiencing one of its worst periods of violence this century, the national economy is doing better than most in Latin America.

Growth last year topped 5 percent for the second consecutive year. The number of new jobs jumped 7 percent, pushing unemployment down to its lowest level in five years. Exports soared, particularly in what for Colombia are nontraditional areas such as oil, coal and flowers. Inflation held at about 23 percent, low by Latin American standards.

Conventional wisdom attributes Colombia's economic strength to a less visible factor than those mentioned above -- namely, the money that enters secretly as a result of the country's most notorious export, cocaine. Estimates of the drug income range from $500 million to $1 billion a year. But economic experts say the profit from cocaine does not explain Colombia's buoyancy and is not, as one economist put it, "the driving force" of the economy.

The contrast between Colombia's economic surge and its collapse of public order has perplexed many here. It led one prominent economist in a recent commentary to quote a line from "A Tale of Two Cities" by Charles Dickens: "It was the best of times, it was the worst of times ..."

No one is quite certain how long the strong economic performance can be sustained in a climate of worsening violence and weakening political control, marked by increasing attacks from leftist guerrillas, cocaine traffickers and paramilitary groups. Already this year, persistent guerrilla sabotage of Colombia's main oil pipeline, which runs across the northern part of the country, has forced temporary suspension of oil flows.

"The question facing the country is whether its good economic prospects will help improve public order, or whether the perverse effects of the violence will cause the economy to deteriorate," said Rodrigo Botero, a former finance minister. "The jury is still out on that."

As with most economic success stories, Colombia's impressive performance is due to a mixture of smart management and good fortune. For much of this century, the nation's governing elite adhered to conservative economic policies. Determined not to repeat the hyperinflation and economic chaos that followed the last great civil war here at the turn of the century, subsequent governments made every effort to keep inflation down and economic changes gradual.

In the 1970s, these conservative tendencies, along with a desire to preserve national autonomy, resulted in Colombia borrowing relatively less from abroad than other Latin American countries. Today, Colombia has the lowest foreign debt per capita ($520) of any major debtor country in the region. In absolute terms, its $15.5 billion foreign debt ranks seventh in Latin America.

"At the time of the go-go years, when foreign loans were freely available, there was a deliberate policy here not to borrow much," recalled Botero, now an economic consultant and magazine editor.

Besides, Colombia didn't need the money. It had its hands full in the late 1970s just managing a flood of foreign exchange from booming sales of coffee, the country's main legal export. Adding to that were increased sales of other Colombian products to neighboring Venezuela and Ecuador, two oil-exporting countries that were experiencing their own booms amid rising oil prices.

During those flush times, though, Colombian officials began to worry. They were troubled by growing imports of oil and by the nation's heavy dependence on coffee exports. So they launched programs to develop Colombian mineral reserves and to diversify exports. The benefits are being reaped today.

Through joint ventures with state companies, foreign firms were drawn here to drill for oil and dig for coal. Two years ago, Colombia reached self-sufficiency in oil; it is becoming a moderate oil exporter. In coal, Colombia now boasts one of the largest mining operations in the world. The El Cerrejon mine, half-owned by Exxon, is projected to produce 15 million tons of coal by 1990.

To promote agricultural and industrial exports, the government devalued the peso by more than 50 percent in 1985. Since then, regular small devaluations aimed at maintaining the peso's real value have ensured that prices of Colombian products stay competitive worldwide. In addition, the government, through an entity called Proexpo, has provided subsidies and low-interest development loans to assist export-oriented companies.

The result has been a surge in foreign sales of cut flowers, bananas, seafood and other nontraditional exports. Gold exports, too, are up, reflecting a gold rush that was sparked a few years ago when the central bank offered premiums for the precious metal, which is mined here. The bank resells some of the gold it buys to replenish foreign exchange reserves.

Colombia's export diversification has made the country less vulnerable to fluctuations in the international price of coffee. In 1987, coffee dropped to 30 percent of Colombia's total exports.

Foreign lenders have gradually come to recognize Colombia's economic record as an example of prudence and discipline, but many banks remain reluctant to pour new money into any Latin American country, regarding the region generally as a bad credit risk. In both 1985 and 1987, Colombia did manage to obtain foreign loan packages amounting to $1 billion each. A planned attempt this year to seek another $1.5 billion is expected to run into difficulties.

Alone in Latin America, Colombia has kept up interest and principal payments on its public-sector external debt without rescheduling. But the government of President Virgilio Barco has since 1986 committed large sums to programs for alleviating poverty, particularly in the vast areas long outside the economic and social mainstream. Government officials here have warned foreign creditors that without new loans, Colombia may yet be forced to go the way of the region's other debtors.