Disagreement over what to many would seem no more than to obscure technical formula for allocating aid to cities almost caused a major split in the ranks of the nation's mayors.

Only a series of meetings here, one involving the White House, averted the break between Sun Belt and Frost Belt cities.

The patch-up effort came last week as the U.S. Conference of Mayors wound up its 46th annual convention with relatively little debate on the troublesome issue of how the aid program, which used to be called antirecession aid, should be focused on depressed areas.

Under the antirecession program, which ends in September, money goes to states and localities solely on the basis of unemployment. Now, with the national unemployment rate dropping, the Carter administration wants to substitute a $1 billion program of supplementary aid to cities based not only on local jobless rates but also on per capita income and the lag in growth of employment and population.

To mayors of the big cities in the Northeast and Midwest, the rub is that the new formula would send the money to $26,000 localities instead of the 22,000 that get it now.

The White House said the extra 4.000 localities would get only 1.7 percent of the aid, but that is small comfort to the mayors here, who see the federal money pie shrinking.

They voted ultimately to ask Congress to consider only unemployment and underemployment in the aid formula, which would keep the number of recipients at about the current level.

But for a time, mayors of smaller cities and those in the South and West were pushing hard to ask Congress to consider such things as family income and pockets of poverty. Those factors would aid fast-growing cities of relative affluence that still have many poor people living in slums.

Those mayors felt they were being ignored not only by the Carter policy but also by the conference itself, which has traditionally been dominated by the biggest cities.

"It was shaping up as a classic confrontation, worse than in any previous time," said Detroit Mayor Coleman A. Young in an interview.

Mayor E. Clay Shaw Jr. of Fort Lauderdale, Fla., said if the dispute had continued, the mayors' organization would have seen "tremendous factionalism."

Because of the Sun Belt's increasing pressure, Young made overtures for meeting of the factions, which he said later "stressed that our commonalities far outweighed our differences."

Several meetings followed, including one a week ago yesterday with presidential aides Anne Wexler and Barry Schlosstein. The officials invited the Sun Belt mayors to the White House next month to discuss their special problems, such as water supply, air quality, open space, energy, federal housing and land-use policy, Indians and illegal aliens.

Also, the conference's new president Denver Mayor William H. McNichols, agreed to create a task force to address those problems plus such concerns of older cities in the North and Midwest, as central city pockets of poverty, long-term unemployment and inner-city neighborhood rehabilitation.

McNichols said that Sun Belt cities have problems "as acute as the genuine horror stories" of the Frost Belt. They want help from this organization, and I think they're entitled to it."

At first, Sun Belt mayors, led by Hugh Parmer of Fort Worth, Tex., temporarily won an effort to add the criteria of family income and pockets of poverty in channeling federal aid. But after a long, convoluted parliamentary fight, that move was reversed.

The battle continued the next day, and the Sun Belt forces lost again. Parmer then organized a breakfast meeting of about 15 mayors from the Sun Belt and other high-growth cities, such as Anchorage, Alaska.

Mayor David Rusk of Albuquerque, N.M., said that at the breakfast, "We recognize that targeting is needed, but we noted that we have needs, too." For example, Mayor Margaret Hance of Phoenix pointed out that her poverty pocket is 40 square miles, bigger than most central cities.

Young, after hearing about the Sun Belt breakfast, contacted Rusk, who arranged for him to meet with several Sun Belt mayors. "We didn't want the big-city mayors to get paranoid - to think we were forming a counterforce," Rusk said.

After the convention ended, he added, "We could have had sharp divisions. What's important is that it didn't happen."