The United States and South Africa, shoulder-to-shoulder comrades in three wars in this century, remain allied through an intricate nexus of trade, diplomacy and culture despite the emotional antiapartheid protests roiling this country for the past two months.

From the platinum in catalytic converters to the uranium in nuclear reactors, South Africa's presence in the United States is discreetly ubiquitous, reflecting a flourishing trade between the two nations that topped $4.5 billion last year.

Only Nigeria, with its rich oil fields, is a larger exporter among African nations to the United States; only Egypt offers a larger market on the continent for U.S. goods.

With a steady stream of exported computers, airplanes, cigarettes, tractors and dozens of other commodities, the United States ranks second among South Africa's foreign suppliers, slightly behind West Germany, according to the U.S. Commerce Department. Only the British have more money invested in South Africa than Americans.

The U.S. diplomatic presence in South Africa is the largest in sub-Saharan Africa, while the South African delegation here is believed to be the second or third largest in the world of Pretoria's posts.

In addition, there are banking ties, a $10 million U.S. foreign aid program, cultural exchanges, a flock of South African lobbyists and robust two-way tourism -- not to mention alleged intelligence links -- that weave the two countries together tighter than many Americans realize -- or find politically palatable.

Where that latticework leads is the $4.5 billion question in Washington this year, as Congress ponders how to juggle the conflicting demands of antiapartheid forces seeking to cuff South Africa economically and commercial interests endorsing the status quo.

"We listen to constructive criticism, constructive views," South African Ambassador Bernardus G. Fourie said in an interview. "The thing that is never possible is when you say, 'You do this or else.' As soon as that 'or else' comes in, it has just the opposite effect."

Sen. Nancy Landon Kassebaum (R-Kan.), chairman of the Senate Foreign Relations African affairs subcommittee, said, "I don't believe economic sanctions are the answer. I don't see it forcing South Africa in any different direction. That's what I see reinforcing their bunker mentality and may well force severe economic disruption."

Besides, Fourie added, "South Africa is one of the few countries at the moment with whom the U.S. has a favorable balance of trade."

In fact, that favorable balance may have ended last year, a victim of the musclebound dollar. Although final figures have yet to be tabulated, Commerce Department statistics for the first 11 months of 1984 show that the United States sold $2.1 billion worth of goods to South Africa while buying $2.4 billion worth.

On the import side of the trade ledger, mineral-rich South Africa remains a motherlode of some of the most critical materials needed by a modern industrial society. More than three-fourths of the chromium -- vital in stainless steel and aircraft engines -- used in the United States in 1983 was imported, with most of it coming from South Africa.

An estimated two-thirds of all imported platinum -- used in catalytic converters as well as in the manufacture of fertilizers, explosives and high-purity glass -- comes from South Africa, which sold more than $550 million of the stuff to the United States last year. The other major foreign supplier of platinum, as well as chromium: the Soviet Union.

The U.S. reliance also extends in varying degrees to manganese (used in steel production), antimony (used as a flame retardant and to inhibit corrosion) and vanadium (also used in steel production and aircraft engines). Also in the U.S. shopping cart in 1984: $485 million in gold Krugerrand coins; more than $140 million in diamonds; plus assorted shellfish, steel, coal, apples, peaches and so on.

Furthermore, because federal restrictions on uranium imports have been lifted recently, shipments from South Africa have grown steadily in the past five years, from less than 400 metric tons in 1979 to nearly 3,000 tons in 1983, according to the Nuclear Regulatory Commission.

Most uranium used in the United States is either mined domestically or imported from Canada. Yet nearly half of the foreign uranium delivered by U.S. nuclear utilities in 1983 to the Department of Energy for enrichment into pellets or rods suitable for reactor operations came from South Africa or Namibia, the neighboring nation now controlled by Pretoria, according to federal documents.

For example, the Virginia Electric Power Co., which recently shortened its name to Virginia Power, used South Africa as a supplier for about 10 percent of the uranium used in its nuclear reactors from 1977 through 1983, according to Nolene Hassett, a company spokesman in Richmond.

Furthermore, according to Energy Department documents, the Maine Yankee Power Co., apparently in tandem with a sister utility in Vermont, bought more than three-fourths of its uranium delivered for enrichment in 1983 from one foreign source: South Africa.

John Arnold, a spokesman for Maine Yankee in Wiscasset, Maine, said the utility had saved $800,000 by swapping some unenriched U.S. and Canadian uranium in 1981, and again in 1983, with a West German company that had some partially enriched uranium originally mined in South Africa.

Through the rest of the century, the Energy Department estimates, more than one-third of all imported uranium will come from South Africa. Part of the reason appears to be price, since in 1983 foreign uranium cost about one-third less than that mined domestically, according to the department.

The trend is nettlesome to some watchdog groups. The Nuclear Control Institute, for instance, in a study released this month, said, "U.S. purchases of this uranium provide Pretoria with much-needed foreign exchange to support nuclear weapons development and to legitimize its occupation of Namibia, where much of the uranium is mined."

Despite the long-running divestment campaign by antiapartheid forces in the United States, American companies remain firmly entrenched as one of the salient features of South Africa's economic landscape.

A new study by the Investor Responsibility Research Center identifies 284 American companies operating in South Africa, including 57 of Fortune magazine's top 100 corporations.

The IRRC found that 30 U.S. companies had severed their South African connections since 1980, while during the same period 11 other firms began new operations there.

Other estimates place the number of U.S. companies peddling their wares in South Africa at 500 to 1,200. The total U.S. investment has been calculated at $15 billion. U.S. firms control an estimated 70 percent of the South African computer market, 45 percent of the oil market and 33 percent of the automotive market.

Of 68 large U.S. banks responding to an IRRC survey, 23 acknowledged having outstanding loans in South Africa, including six that listed loans to the government or state-controlled corporations. For example, the NCNB Corp., a bank headquartered in Charlotte, N.C., has $196 million in outstanding South African loans, including some to state industries, a bank spokesman said.

Although American and South African soldiers fought together in both world wars and in the Korean war, military ties between the two countries are minimal, according to a Pentagon spokesman. No U.S. weapons or military equipment have been sold legally to the South Africans since 1961, except for a shipment of "shock batons" -- cattle prods that sometimes are used on people -- approved for export several years ago when "we screwed up," a State Department official said.

U.S. Navy vessels ceased making port calls in South Africa in 1969 because of "obvious difficulties in the way black sailors are treated," the official added. Every year, a single South African naval officer attends the U.S. Coast Guard Academy for instruction in buoy marking and navigational safety. Several times a year, a U.S. Air Force plane flies to South Africa to replenish embassy cupboards.

There have been allegations of covert intelligence ties between the two countries. Author Andrew Cockburn wrote last month that a South African intelligence center near Cape Town "routinely dispatches intelligence to the National Security Agency headquarters in Maryland."

Cockburn also contends that the South Africans provide landing facilties for Air Force RC135 electronic intelligence aircraft in exchange for U.S. intelligence on black African governments and organizations.

A Defense Department spokesman, Lt. Col. Bob Shields, flatly denied any exchange of landing rights for U.S. intelligence. When asked whether the RC135s ever use South African airstrips, regardless of any quid pro quo, Shields said, "I don't think we'll be able to comment on that at all."

Other ties are less shadowy. Justice Department foreign agent registration documents show that 31 agents, some with close ties to the Reagan administration, are representing South African interests in the United States, compared with 22 in 1979. Many major foreign powers, or foreign corporations, retain similar agents in Washington to serve as their eyes, ears and voices.

Foremost among the South African representatives is the law firm of John P. Sears, who served as Reagan's campaign manager until being dumped in early 1980 and who now collects $500,000 a year from the Pretoria government.

As recited in the Justice documents, the firm in 1984 "monitored and analyzed U.S. presidential and congressional nominating and election process," "analyzed press articles and published reports concerning U.S.-South African relations" and arranged an appointment in October for management executives of the South African steel corporation with staff members of the U.S. Cabinet Council on Trade.

The other major lobbyist for Pretoria -- to the tune of $300,000 annually -- is the law firm of Smathers, Symington & Herlong, headed by former senator George A. Smathers (D-Fla.) and former representative James W. Symington (D-Mo.).

During a six-month period in 1984, the firm "advised and counseled" on 16 pieces of proposed congressional legislation affecting South Africa. In one six-day period in October, for example, the agents lobbied against proposed restrictions on U.S. investment in South Africa by buttonholing Sens. Robert C. Byrd (D-W.Va.), Robert J. Dole, (R-Kan.), Russell B. Long (D-La.), Jennings Randolph (D-W.Va.), Jesse Helms (R-N.C.), and John P. East (R-N.C.). The proposals eventually died.

Among other ties between the United States and South Africa:

* The U.S. Agency for International Development oversees a $10 million annual foreign aid effort that provides college scholarships for black South Africans, training for black businessmen, and grants to community groups supporting civil and human rights.

The Immigration and Naturalization Service counted 47,251 visitors from South Africa in 1983, including 9,000 businessmen; American visitors to South Africa are estimated at 70,000 a year.

* The U.S. Information Agency recruits several dozen black and white South Africans every year to tour the United States talking about their country, and other groups sponsor similar exchange programs.

The South Africa Foundation, for example, a registered agent financed by corporate and individual contributions, last year awarded 11 "travel fellowships" for visits to South Africa. Among the recipients were seven members of Congress, former national security affairs adviser Zbigniew Brzezinski and former White House counsel Leonard Garment.

Many observers believe the sheer volume of public protests against apartheid will strain at least some of these ties in coming months. Rep. Robert S. Walker (R-Pa.), who last month wrote a letter signed by 35 conservative House Republicans demanding the immediate dismantling of apartheid, supports a ban on federal contracts to companies doing business in South Africa without endorsing the so-called Sullivan principles of better working and living conditions for nonwhite workers.

"There have been some people who have suggested it was kind of strange company we were keeping if we were on the same side as TransAfrica an outspoken antiapartheid organization and other groups that have a decidedly left-wing complexion," Walker said. "But we have said that we are not adopting anybody else's agenda."

Kassebaum, the Senate Republican from Kansas, believes that the U.S. government needs to be more forceful in protesting particularly offensive aspects of South African apartheid, such as the use of internal passports for blacks.

"If they think that they can just sort of play us along, we have to at some point say, 'This is it,' " she said. "But I'm not sure that it's something that's best done on the front page."