For the second time in eight years, Australia's alliance with the United States -- unquestioned over the previous three decades -- has become a central issue in a national election here.

When they go to the polls on Oct. 18, Australian voters will, to a large extent, be registering their judgment on this country's relationship with its long-time ally.

The last time the issue came before the voters in 1972, charismatic leader Gough Whitlam took his leftish Labor Party into power on a platform which included withdrawal of Australian support for the American fight in Vietnam and demands for greater control over American military bases and business enterprises here.

Whitlam kept power for three turbulent years during which he openly criticized American foreign policy, an unprecedented act for an Australian prime minister, and tried with only limited success to negotiate Australian participation in the control of sensitive American communications, intelligence and satellite-control bases here.

The Whitlam government was thrown out in November 1975 by the governor general, Sir John Kerr, after a constitutional crisis triggered by refusal of the conservative-controlled Senate to approve appropriations for the Whitlam government.

Conservative Malcolm Fraser appointed prime minister. His selection was legitimized in vigorously democratic Australia by landslide election victories in December 1975 and December 1977.

Fraser soon got rid of the controversial Kerr and Whitlam stepped out of politics after his drubbing in 1977, handing over the reins of the Labor Party to a former Queensland police officer who had briefly been treasurer in Whitlam's Cabinet, William George Hayden.

American capital was lured back after a virtual moratorium during the Whitlam years and American companies began to involve themselves in development of the huge coal, uranium and bauxite resources which promise to make Australia a boom country through the 80s.

Two weeks ago, when Fraser announced a general election for Oct. 18, most Australians thought he would coast back to power even though polls showed that his authoritarian, remote style of leadership had made him personally the most unpopular Australian political leader in history.

Meanwhile, Hayden has spent the last 12 months touring the country and developing detailed policies to curb Australia's record unemployment with government projects, improve the national health insurance scheme and stem the ever-rising price of gasoline -- all domestic policies of immense appeal.

Suddenly, this weekend, the coalition of conservative urban and rural parties supporting the over-confident Fraser found their leader was in deep trouble. Three separate opinion polls showed Labor well ahead -- one by a margin of 15 percent -- even though most voters who said they would vote Labor still thought that Fraser would win.

It was clear that his own unpopularity and his dour domestic policies -- a tight budget deficit, no taxation concessions and an all-out attack on inflation rather than unemployment -- was hurting Fraser in a manifestly materialistic nation.

Ever since the Soviet invasion of Afghanistan, Fraser had been tolling the warning bell of the Soviet threat to Australia -- a lifelong passion of Fraser's -- and had been moving to link the United States more firmly into defense agreements with Australia.

Apparently hopelessly behind on domestic issues, the prime minister has switched his tack to foreign policy and defense -- and has focussed the issue directly on the American alliance.

He has already offered the use of Australian air bases to American B52 bombers on training missions and on surveillance flights over the Indian Ocean.

Two groups of b52's have already used northern Australian bases for refuelling and the Pentagon is currently negotiating arrangements -- largely who should foot the bill -- for upgrading four Australian bases to B52 standards. For political reasons in both countries, a final agreement on the B52's and on an Australian offer for the U.S. Navy to use Cockburn Sound, near Perth, as a base, is not likely before the elections in both countries are over.

But Fraser has now spelled out his terms for the basing of B52s here. Provided there is prior consultation with Australia over the nature of their mission, B52's will be allowed to carry nuclear weapons and there will be no disclosure in Australia of which, if any flights, are so equipped.

Fraser says his decision is based on the fact that Australia is a military ally of the U.S. through the ANZUS pact and that Australia has an obligation to help the United States defend the noncommunist world. His theme now is that defense and foreign policy cannot be trusted to the "socialist" Labor team.

It is an awkward issue for Bill Hayden, who is personally a strong supporter of the American alliance but whose party contains a powerful left-wing faction which wants to end the alliance, expel American bases in Australia and declare Australia neutral in international affairs.