The first major attempt in West Germany at political cooperation between the Social Democratic Party and the radical left Greens failed today when the two parties, unable to work out an agreement in Hamburg, voted to dissolve the city-state parliament there and hold new elections Dec. 19.

Klaus von Dohnanyi, the Social Democratic mayor who had sought an arrangement with the Greens to keep his minority government in power, announced two weeks ago that he had given up the effort in frustration. But the opposition Christian Democrats threatened to block a motion for new elections unless Dohnanyi's government resigned first, and the Greens seemed to be leaving the door open for further talks.

Today, however, the Greens reluctantly sided with the Social Democrats in a motion to disband parliament, declaring that new elections had become unavoidable.

The collapse of the Hamburg experiment appeared to be a setback for Willy Brandt, the national Social Democratic Party chairman. As the populist, countercultural Green movement has gained representation in regional parliaments this year, Brandt has argued that his own party has to emphasize more its resistance to nuclear power and nuclear weapons to attract some of the Greens' youthful supporters.

After elections in June produced a hung legislature in Hamburg -- the Christian Democrats won 56 seats, the Social Democrats 55 and the Greens 9 -- Dohnanyi saw an opportunity to try for an arrangement with the Greens.

But the risk for the Social Democrats in this was a split in its own unsettled ranks, and Dohnanyi finally abandoned his efforts when this risk appeared to be growing. The Social Democrats were particularly divided over a proposal by the Greens' representatives to declare Hamburg a nuclear-free zone.

In addition, a government program drafted by Dohnanyi was rejected earlier this month by the Greens because it did not meet their demands for elimination of nuclear power, toleration of radicals in the civil service and some environmental causes.

The Hamburg election will come three months before federal elections that the new Bonn government has promised for next March and can be expected to assume particular significance as an early political weather vane for Chancellor Helmut Kohl.