Former Rep. John L. McMillan (D-S.C.), who wielded vast and often resented power over District affairs for 24 years as chairman of the House District Committee, died yesterday in Florence, S.C., his home town.

Mr. McMillan, who was 81 years old, had been under treatment for prostate cancer for two years. He died about 5:30 p.m. at Florence General Hospital, to which he had been admitted last Friday.

During his tenure as District Committee chairman, which began long before home rule, Mr. McMillan was viewed as the holder of ultimate authority for almost every aspect of life in the city from parking space assignments to public employe payrolls.

For much of his long tenure as chairman, which began at the close of World War II, Mr. McMillan won praise from city business interests and conservative congressmen who were his allies in opposing home rule for the District.

Liberal congressmen and other supporters of self-government here depicted him as a tyrant, who they claimed ran his committee with a dictoratorial hand. Many leaders of the black community accused him of racism.

At the end of 1972, after defeat in a hard-fought Democratic primary ended his 34 years as the representative of his state's 6th District Mr. McMillan issued a report that gave his own view.

"He loved his country and its capital and honored his pledge to uphold the Constitution," the report said.

Mr. McMillan held office during a time of vast social and political change in the nation, the South and the city of Washington. His experience at the polls and the power he exercised as chairman of the District Committee may be regarded in a sense as barometers of that change.

In the view of some observers, the authority of Mr. McMillan over city affairs began to erode significantly in 1965, when the House of Representatives took a home rule bill out of the hands of his committee.

Spurred by intense lobbying from the Johnson administration, the House voted by 213 to 183 to bring the bill to the floor.

Mr. McMillan argued during the historic debate on the home rule bill -- the first to reach the floor since 1948 that Washington is a "federal city . . . the only city created for a federal purpose." The bill he contended would "give it away."

The Johnson administration home rule measure was eventually defeated. But the rare vote to wrest it from the hands of Mr. McMillan's committee was seen as a watershed in local politics.

In 1967 it was Mr. McMillan himself who introduced the bill that gave the District an elected 11-member Board of Education. Previously school board members had been appointed by judges of the U.S. District Court.

In the same year, however, Mr. McMillan, never renowned as an orator, stood in the well of the House in an effort to persuade his colleagues to vote against a Johnson administration measure that reorganized the city government.

The measure, which replaced the city's three-member Board of Commissioners with an appointed mayor and council, was widely viewed as a step towards full home rule.

"Who's going to have time to keep up with all this council is doing uptown?" Mr. McMillan demanded.

In what was regarded as in effort to educate his House colleagues about the possible ramifications and drawbacks of the administration proposal, he warned: "you people will be required to get D.C. tags [for cars."]

"This is your baby," Mr. McMillan told the House at another point. "If you want to vote for it, I'm not going to lose any sleep about it."

The measure did pass, and at least one witness observed that contrary to his assurances, Mr. McMillan looked weary.

Despite what appeared to be mounting pressure on Mr. McMillan by the advocates of Home Rule, it was not until 1973 when he was gone from the House and from the District Committee chair, that the committee voted out a Home Rule measure.

Mr. McMillan's rejection by the Democratic voters of his district in a 1972 primary runoff reflected at least in part the changes in national politics since he was first sent to Congress in 1938.

In that first election, he defeated five opponents. In 1940, Mr. McMillan faced a single foe, and won by 18,000 votes. By 1948 and for many years afterward, he faced no opposition at all.

In 1964, something unusual happened. A Republican was nominated to oppose him. Mr. McMillan won by about 50,000 votes to 25,000, but the day of uncontested November elections was over.

Four years later, Mr. McMillan faced a closer than usual primary challenge. His campaign literature continued to describe him as a member of the "coalition of conservative Democrats and Republicans" that reduced "every budget that has been presented by the five presidents he served under."

But at the same time, he took pains to note the federal programs he supported. He claimed, for example, that it was his vote that brought the food stamp bill out of the Agriculture Committee.

In 1970, Mr. McMillan was forced into a primary runoff with his Democratic opponent, a black physician. In that year's primary campaign, home for Washington was an issue in the politics of Mr. McMillan's largely agricultural, tobacco-growing district.

Many D.C. residents went to South Carolina to campaign against McMillan, who eventually won in the runoff and in the general election. Back in Washington he withstood an unusual effort by restive liberals in a changing House to dislodge him from his District Committee chairmanship.

In 1972 came the Last Hurrah. "Johnny Mac," as he was called, the University of South Carolina football star, friend of the tobacco farmer and virtual charter member of his local courthouse crowd lost in a primary runoff.

Mr. McMillan blamed his defeat on the black vote. "The colored people were bought out," he said.

An analysis of returns showed that blacks cast about 17 percent of Mr. McMillan's votes. About 47 percent of his opponent's votes came from blacks.

John Jenrette, who defeated Mr. McMillan, lost to a Republican in the 1972 general election, but won the seat two years later. Charles C. Diggs (D-Mich.) became the new chairman of the District Committee.

Mr. McMillan's defeat seemed to mark the end of an era. He became head of the District Committee when blacks were in the minority here. He remained until blacks formed more than 70 percent of the population.

Many blacks contended that he ignored their needs in such areas as housing, welfare and law enforcement. Critics of the committee claimed its proceedings, particularly as internal opposition grew, were characterized by bickering and pettifoggery.

As chairman, Mr. McMillan was in a position to issue his won valedictory. A committee report subtitled "Activities of McMillan as Chairman," issued just before he left, said that bills he sponsored or supported made Washington one of the world's great cities, and calls him "the best and most effective friend the nation's capital has ever had."

Survivors include his wife, Margaret, and a son, John Jr.