Police chief Charles Gain sits alone in his cavernous office, surrounded by departmental reports and the memorabilia he will soon pack into cartons.

A veteran of battles with rank-and-file police organizations in two other cities, Gain speaks in tones of quite resiganation. He has been here before. c

"They have an awful lot of political clout," Gain says of the local police officers association, which played the central role in his ouster as chief last July.

"There has been a phenomenal growth in unionism, and there are very sound reasons for the police to organize themselves," he said, his voice trailing away.

"But a concern I have about it is that citizens still do not understand the phenomena of crime, and they look to the police for protection. They attribute special abilities to the police, and so they look up to police associations.

"As a result, the police unions can start to control the politics of the city," warns the lame duck chief. Gain will step down in January after four years on the job. (This summer, under pressure from the city's police union, Mayor Dianne Feinstein demanded Gain's resignation charging that the he had lost control of his department. Gain and the conservative rank-and-file had long been at odds over his reform policies, including the recruitment of homosexuals.)

Barely a block from Gain's office at police headquarters, 32-year old Bob Barry, a nine-year veteran of the force and president of the San Francisco Police Offers Association, walks authoritatively through a bustle of secretaries and aids at the association's office.

He speaks proudly of his group's success in winning the dismissal of the once-popular liberal police chief, and of a recent endorsement meeting with candidates in the city's upcoming supervisorial elections.

"You've got to get involved in the political process in order to survive," Barry says. "I think we are getting into another level of sophistication now -- hiring professional firms to do political polling and installing a computer system to track bills in the legislature.

"We've been very effective," Barry says, "not only at the local level but at the state level as well."

Barry and Gain have been playing representative roles in a growing national controversy over police administration, as rank-and-file officers shed their traditional image of nonpartisan professionals and plunge into politics.

Increasingly over the past decade, police associations have employed strikes, "blue flu" sickouts, court actions and sophisticated lobbying campaigns to press their demands on local governments. They have been remarkably successful in winning hefty pay packages, gaining a say in internal departmental policy, challenging the authority of police chiefs and shaping criminal justice legislation.

Some recent examples:

Last November, police in Los Angeles raised nearly $450,000 to campaign against a ballot proposition that would have eliminated a lucrative police pay formula. Despite the local fiscal squeeze brought on by Proposition 13, the electorate voted down the ballot measure.

In Montgomery Country, Md., last fall, the Fraternal Order of Police voted "no confidence" in Police Chief Robert J. di Grazia, and endorsed di Grazia critic Charles Gilchrist in the local county executive election. Only weeks after taking office, Gilchrist fired the chief.

In neighboring Prince George's County this year, the Fraternal Order of Police defied Chief John Rhodes by staging a one-day walkout, and also voted no confidence in his administration. In May Rhodes resigned his post because of medical problems and the turmoil in his department.

Unsatisfied with a pay package awarded through binding arbitration with the financially beleaguered city of Cleveland, the local patrolman's association put pressure on the city council early this month and secured an additional 2 percent pay bonus.

The success police have enjoyed in exerting their influence over local governments has sparked concern among civil libertarians that the police may be getting out of control. Without the restraints normally imposed by civilian officials or police chiefs, they say, the police will be able to run roughshod over the rights of minorities and other groups.

A recent study by the Justice Department's Community Relations Service concluded, for example, that disputes between police and minorities have now become the major cause of racial unrest in the country.

Critics most often point to Philadelphia, where the Justice Departmen in August filed a massive civil rights suitcharging 18 top police and city officials with condoning "systematic" police brutality toward blacks.

"The source of their power is the public's fear of crime and the fears of politicians that they will appear 'soft on crime,'" explains James Chanin, past president of the Berkeley, Calif., Police Review Commission, one of the last remaining independent review boards in the country. "It's extremely difficult to be in power on a local level and attack the police.

"The military's power over Congress," Chanin said, "is nothing compared to the power of the police over city government."

Police association leaders, however, defend their push into unionization and politics as the natural result of years of neglect by local officials.

"In the past, the police department was autonomous and over in a corner somewhere," says Bill McNea, president of the 1,500-member Cleveland Police Patrolmen's Association. "But the police are learning if you want better benefits, better equipment, you better get involved with the city council.

"Before, you got whatever was given to you," McNea says. "Now anything that comes down in the city, we have a say in it."

The involvement of the police in local policymaking comes as an offshoot of a decade-long drive toward unionization of rank-and-file officers. A recent survey by the Washington-based Police Foundation reported that the number of American cities with police unions doubled over the 10-year period ending in 1977. Two out of every five municipal police forces had been unionized, the survey showed.

The local unions have also affiliated themselves with national labor organizations, from the Service Employes Union to the Teamsters. In February, the AFL-CIO chartered the International Union of Police Associations, which its officials say will represent one-fifth of the nation's 500,000 law enforcement officers by July.

This year 20 American cities and counties have been hit by sickouts, slowdowns or strikes sponsored by local police associations. Even more significant has been the less publicizedpush of police organizations into the political arena.

In California, two statewide police organizations have sent professional lobbyists to the state capital and have set up political action committees to serve as conduits for legislative campaign contributors. By all accounts the police have become one of the most potent lobbies in Sacramento.

Several years ago they secured passage of a "Policeman's Bill of Rights" that strictly defined the scope of local departmental investigations of alleged police miconduct. This year, according to Jack Pearson, president of one of the groups, the Peace Officers Research Association of California (PORAC), 23 of the 24 legislative bills they targeted for "active support" were signed into law.

In large because of his support for the "bill of rights," California Gov. Edmund G.(Jerry) Brown Jr. won the endorsement of both state police organizations in his reelection bid last year. "If any endorsement for the governor contributed to his victory," said Gray Davis, Brown's chief of staff, "then the police and the Howard Jarvis endorsements were the ones." (Jarvis was the leading force behind the Proposition 13 drive last Year.)

Even more impressive has been the role of police associations in local politics.In San Francisco, the police successfully lobied the board of supervisors to block racial hiring quotas in the department, and for three successive years have prevented formation of a bar association-sponsored agency to investigate citizen complaints.

"The POA is a force to be reckoned with," says Agar Jaicks. president the San Francisco County Democratic Central Committee.

"The police always are a danger", Jaicks adds, pointing to a number of recent altercations between police and minorities. "I'm not saying San Francisco is a garrison state, but it has the potential for it."

POA President Bob Barry dismissed the fears over growing police political power.

"The stereotype is that police are law-and order demogogues, but they're not," Barry insists. "Some are Democrats, some are Republicans, some are socialists. They are no different than any other person in the city. s

"I know I would never want to see a Frank Rizzo in this city," Barry continues, referring to Philadelphia's controversial police commissioner-turned mayor. "I don't like that concept of law enforcement."

Other observers point hopefully to affirmative action requirement and the unionization trend as possiblei-liberalizing influences on the police. In Washington, for example, left-learning Mayor Marion Barry has worked closely with the police union.

Whatever the political alleginace of the police unions, there is unanimous agreement that the days of the nonpartisan police departments are over.

"It doesn't do any good to play marbles in the parking lot," explains Porac president Jack Person, "when the world Series is going on in the stadium next to you."