Bilbao, the Basque country's main city and its industrial center, is staging its annual fiestas this week with bull-running, bullfights and round-the-clock drinking and dancing patterned after the more famed festivities of Pamplona.

But beneath the gaiety is a deepening political cleavage among the Basques marked recently by a heated controversy over the flying of the Spanish flag in the Basque country.

In a new strategy of confrontation with the central government in Madrid, radical Basque nationalists sympathetic to the separatist aims of the terrorist organization ETA have begun burning Spanish flags hoisted during local fiestas.

In response, Prime Minister Felipe Gonzalez's government has taken a firm stand. In Basque villages and towns controlled by Gonzalez's Socialist Party, mayors have insisted on flying the flag and called in police reinforcements to protect it. In town halls where Basque nationalists have a majority, the Madrid-appointed provincial governors have enforced a constitutional provision calling for the national flag to be honored.

The flag issue is a highly emotional one in Spain, particularly among the officer corps. In a speech last month, as the fiestas and demonstrations in the Basque country were beginning, King Juan Carlos called for respect for the Spanish flag, "which we will not permit to be dishonored."

The stand taken by Gonzalez over what the Spanish press has called "the battle of the flags" has earned his government plaudits from conservative sectors who on other issues have been hostile to the Socialist administration. The conservative press has praised the no-nonsense approach and compared it favorably with the vacillations of earlier Center Party administrations, which allegedly ceded ground to Basque nationalists.

In Bilbao, scene of the latest festivities and tension, the national police have occupied the imposing city hall and, acting on orders from the governor, have raised the Spanish flag as well as the local Basque flag and Bilbao's city emblem.

Protesting what he called "an illegal occupation," Bilbao Mayor Jose Luis Robles has moved his offices out of the city hall. His nationalist-controlled city council had voted before the fiestas not to fly any flags, in order to reduce tension. Last week when fiestas were held in San Sebastian, dozens were hurt in rioting and a radical Basque nationalist member of the San Sebastian council was indicted after leading a group that pulled down the Spanish flag.

The Gonzalez government's actions, however, have prompted misgivings among liberals who claim that, by attempting to placate a potentially restive military and rightist sector, it has aggravated the historically complex Basque problem.

Yesterday the influential Madrid newspaper El Pais, in an editorial on the police takeover of the Bilbao city hall, said the show of strength had polarized Basque opinion further and weakened the politically moderate Basque Nationalist Party, the major political group in the area.

"The nationalist radicals have recovered the initiative in Basque politics and are ready to start once more the spiral of action-repression-action," the paper said.

Xavier Arzullus, president of the Basque Nationalist Party, accused the government of "an absolute lack of tact." He told reporters today that the only victors in the dispute were "the extreme Basque nationalists and the extreme right wing."

The tension in northern Spain's Basque country, which has a population of 2.5 million, underscores the difficulties of a new decentralized administrative framework introduced along with the restoration of democracy after the death of Francisco Franco. The Basque country comprises a so-called autonomous community with a measure of self-government under the current quasi-federal arrangement.

A government bid to lay down strict guidelines on the scope of self-government in new legislation, however, was blocked two weeks ago when the Constitutional Court ruled against several key articles. The bill had been drawn up by the previous Center Party administration after the attempted military coup in 1981 and had been endorsed by the Socialists, who were then the opposition.

Firm opposition by the Basque Nationalist Party and its counterpart in the autonomous area of Catalonia, in northeast Spain, forced the government to test the legislation before the Constitutional Court.

The court's ruling upheld arguments that the bill would undermine existing self-governing prerogatives of autonomous communities and was greeted by nationalists in Catalonia as a setback to the Gonzalez government.