When it comes to foreign affairs, Americans tend to learn through crises. We found out all about Vietnam because our soldiers began to die there. We discovered Iran when the shah collapsed and our countrymen there were taken hostage.

Understanding problems and places abroad before they achieve full-fledged crisis statue is, clearly, in Americans' best interest. The misfortunes in Vietnam and Iran were the consequences, in some measure, of our collective ignorance. Disasters happened before we -- as a people -- knew enough about the circumstances to do much good.

With that in mind, "NBC White Paper: The Castro Connection" (airing on Channel 4 tonight at 9:30) is well worthwhile.

For 90 minutes, the complex and highly volatile situation in Central America -- mainly Nicaragua, El Salvador and Guatemala -- is examined in a way television does best: graphically and simply.

Marvin Kalb, in his first major project as NBC's diplomatic super-correspondent, neatly weaves together the domestic conditions in the countries under study with the political realities here in this presidential electoral season. The unifying theme is the role of Fidel Castro, hardly a new concern for U.S. policymakers but worth a reasoned look such as the program provides.

Kalb's conclusion is that the dilemma for the United States now is not merely Castro's influence with anti-government forces in what was a comfortably pro-American preserve. Rather, it is that the "United States, at this point, has no counter-formula. The traditional mix of Marines, money and munitions is wildly outdated. No one has yet concocted a new mix strong enough to head off a slow takeover of Central America by Marxist revolutionaries with a Castro connection.

"The Carter administration seems genuinely perplexed by the problem; some critics say paralyzed, reinforcing the impression that the U.S. is impotent in the struggle . . . "

That judgment may be somewhat harsh. Many specialists believe that the Carter people have been relatively successful in making the transition in Nicaragua from the ousted Somoza regime to the new Sandinista-led government, in power now for over a year.

As the program demonstrates with good footage, the Cubans do play a substantial social and military role in Nicaragua and the Sandinistas are clearly leaning the Sandinistas are clearly leaning in Castro's direction. But the United States has not been frozen out as much as it has in some other former clients -- Vietnam and Iran, to name two.

In the words of Miguel D'Escoto, Nicaragua's foreign minister (a Maryknoll priest, incidentally): "We are . . . creating a truly Nicaraguan revolution, and the fact that we have relations with Cuba no more means that we are following a Cuban model than the fact that we have relations also with Costa Rica, or for that matter even with the United States. Believe me, we want to have very good relations with the United States but we are not about to make a second United States here, or a second Puerto Rico or a second Cuba, or a second nothing . . . "

Accepted at face value, D'Escoto's remarks indicate that the United States could well develop a normal relationship with Nicaragua despite the Marxist rhetoric and the wounds of our long association with the reviled Somoza regime. A clip of senior U.S. diplomats chatting amiably at a Sandinista anniversary celebration shows that the United States, for now at least, is not being frozen out -- which leaves less room for Castro.

But the difficulty with the region as a whole, spelled out in interviews and film, is a tendency there and here toward polarization.

The Left, especially if it calls itself Marxist, is regarded as a direct threat to American interests and makes people like Ronald Reagan opt for a last stand in favor of the status quo, no matter how unpopular. The Right, which usually means the military and major landowners, represents a ripe target for ideologues like Castro.

Film, particularly from El Salvador, of executions left and right offer a depressing choice of evils. What is missing from Central America, as several pundits, including Henry Kissinger, observe, is "a moderate, democratic alternative in the name of which we can replace the oligarchies and resist the totalitarians."

In that situation, Kalb asserts, in essence, Cuba has proven better at exploiting matters than the United States.

The irony, of course, is that Cuba is no paradise either. John Alpert, a free-lance documentary-maker whom NBC uses to make gritty pieces about the human side of places like Iran, Cambodia and New York (during the Democratic convention), offers a portrait of Cuba that shows empty shelves and parched fields. Alpert also shows some spiffy worker apartments and free medical care that look like standard-issue Cuban propaganda. Still, the overall impression remains clear: The Cubans and Fidel Castro should have enough to do without messing around in the El Salvadors and Guatemalas of this world.

Central America is a highly dynamic place where the United States has important economic and security concerns. Change is coming there whether our political leaders like it or not. Americans need lessons in Central America and NBC has given us a useful one.