Two years ago, when the two cities were in trouble, there were astute politicians in both Atlanta and Detroit who wouldn't have given a plugged nickel for the re-election chances of their first-term black mayors, both Democrats.

That's all changed now. Barring some last-minute catastrophe, Maynard Jackson of Atlanta, who faces the voters today, and Coleman Young of Detroit, who is up for re-election Nov. 8 will win by overwhelming margins.

It's a measure of how far race relations have progressed in both cities that although nearly half the registered voters in each are white, the most serious opponents to both candidates are black.

Neither has any serious white opposition. Both relied heavily on black support to win four years ago, but have since convinced a lot of skeptics, and broadened their support to the point where they are now strongly backed by their cities' white economic power structures.

Jackson and Young are very different people. Now trim after shedding more than 100 pounds over the past two years, Jackson, 39, comes from a cultured middle-class family so patrician that a friend once remarked if he'd been born white in Boston, he'd be a Cabot or a Lodge.

Young, at 59, still spices his public language with salty epithets, even on television, and until recently used to run over to the Black Bottom slum where he grew up to play poker with his old ghetto buddies.

Both came to power in cities with nearly 50-50 black-white population ratios. And both, sensing that one major problem was black frustration, concentrated immediately on moving control of all levels of the political structure firmly into black hands.

Both had stormy first terms as the whites who controlled each city's economic structure, as well as those in the police and fire departments, struggled to see if they could continue to decide where the lines of compromise with the new black political structure would be drawn.

Both established affirmative action programs and made frequent pro-black statements that frightened many whites at the same time that they delighted blacks who felt neglected by previous administrations.

But then, during periods of civic crisis, each welded together important blocs of white support by taking decisive actions clearly not in the immediately interests of the blacks most directly involved.

A recession triggered by the 1973 Arab oil embargo hit the nation just after both mayors took office. By late 1974, Detroit seemed headed for economic disaster.

Auto layoffs drove unemployment up to 20 per cent, with the rate among the young, the unskilled, and inner-city residents hitting more than double that. Falling revenues pushed the city toward a $103 million budget deficit. Local banks balked at lending the city money. Young was the center of controversy as he prepared an austerity budget, cut city services, and laid off nearly 4,000 city workers, even though the layoffs undid much of what his affirmative action program had accomplished.

There were other problems, too. Detroit's crime rate was the highest in the country. A war among drug dealers brought the nickname "Murder City." White flight drained middle-class money and talent. One newspaper called it a "dying city on a dying river."

Today, in a rather startling illustration of how difficult it is to predict events, much of that is turned around.

Detroit is enjoying what local economists say is a genuine economic boom that they expect to last.A local index lf leading business indicators has soared to its highest level ever, and is still climbing.

Unemployment, dropping steadily since January, reached a low of 9.5 per cent in the city in July, and nearly half that, 5.2 per cent, in the metropolitan area. National unemployment for July was 6.9 per cent.

There is no more budget deficit. SOme 27 major construction projects worth more than half a billion dollars are under way or set to begin in the downtown area, compared with only three at the time Young took office.

Many, like the $23.5 million river-front ice hockey arena, involve large commitments of private money. "I would say there's more confidence in the mayor from the business community," said Chamber of Commerce vice president Jack Steiner. "I would base that on dollar contributions to the mayor's campaign."

Young was reported in early September to have a campaign war chest of $100,000, and a contributors list that read like a Who's Who of Michigan business, while his opponent. City Councilman Ernest C. Browne Jr., 51, had spent most of the $35,200 he raised.

Some of that may be a bandwagon effect. Young ran away with 55.1 per cent of the vote in the Sept. 13 primary election, compared to Browne's 21.1 per cent, and 19 per cent for two white candidates who ran third and fourth. Browne, who is black, found most of his support in white neighborhoods. He is more politically conservative than Young.

Crime is down in Detroit as well, some 24 per cent overall during the first eight months of this year, accordin to Executive Deputy Chief James Bannon. Downtown restaurant owners report the drop in crime, coupled with the new construction and the just-opened $337 million Renaissance Center office and commercial complex on the riverfront, has their business up 10 to 40 per cent.

Young owes much of his popularity to events he had little or nothing to do with. The national economic recovery put the auto industry back in business, and it employs 11 per cent of the city'a labor force.

The glass-curtained cylindrical towers of the Renaissance Center, creditied with a major share of the downtown revival, were proposed in 1971 by Henry Ford II, and privately financed by a Ford-led group of wealthy area industrialists.

But Ford, political observers are fond of pointing out, is a buddy of Young's. Young calls him "Hank the Deuce."

And those observers credit Young with acting as a more aggressive, more effective catalyst for pulling together influential people from all walks of life to help detroit than any other recent Detroit mayor.

President Carter, as Young proclaims in his campaign literature, is a friend who has stayed at the mayor's home. "$800 million says Mayor Young is the best Washington lobbyist Detroit has ever had," reads one campaign brochure.

More than half a dozen of Young's former top aides hold influential posts in the Carter administration, and some of them are generally credited with cutting red tape for the city on public works and other money.

In Atlanta, Mayor Jackson has followed some of the same tactics. He also has a network of national contacts more extensive than his predecessor's. He, too, reaps some of the benefits from a national economic recovery he had nothing to do with.

Crime in Atlanta is also down, under a black police chief who has been much more controversial than the one in Detroit. Minority employment is up. And the Atlanta Chamber of Commerce and other influential white business groups that feuded on and off with Jackson during his first term are solidly and publicly behind him now.

Attorney David Franklin, a close adviser to Jackson, said a Pat Caddell poll commissioned by the mayor's campaign and taken in August gave Jackson a 76 per cent overall favorability rating.

While Young's determination to cut Detroit's budget during difficult times helped coalesce white business support behind him, Jackson accomplished the same thing by breaking a strike of low-paid, mostly black garbage workers earlier this year.

Jackson had been saying for a year and a half that the workers, represented by the American Federation of State, County and Municipal Employees, needed and deserved a raise.

But when they struck, he fired 1,000 of them, claiming the city could not raise their pay and keep its budget balanced. Most have since been rehired in other jobs, principally federally funded ones.

That, one adviser said, helped make whites "less paranoid."

"There was a lot of disagreement over how he handled the garbage strike in the black community," said one influential black businessman, " . . . but never enough that there was any thought of not supporting him."

Jackson's principal opponent, Emma Darnell, a 38-year-old black woman whom he fired as head of his Administrative Services Department, is expected to pick up the votes of blacks who no longer feel they can support Jackson. But she has little white support.

Atlanta did not suffer as much as Detroit during the recession. Jackson campaigns on a record of weathering "the worst national recession in 40 years with no deficits and no laying off of any city employees."

He also points to the beginning of a long-sought $400 million airport expansion, the continuation of several million dollars worth of downtown business and convention center projects, and an effort to open the doors of city hall to newly organized neighborhood community groups.

Business indicators have improved for Atlanta in the past two years, according to the Chamber of Commerce. Unemployment is now around 10 per cent, compared to 6.7 per cent for the metropolitan area. The city has opened a New York office to lure new plants south.