ROCKPORT, MASS. -- This seaside colony whose charms have attracted many artists has found itself fighting a court battle with the Smithsonian Institution over a bequest in a millionaire sculptor's will.

Franz Denghausen, the sculptor and poet who lived in Rockport for 36 years, left $1 million to the town to replace the small, turn-of-the-century Carnegie Library.

But the Smithsonian, which also benefited from Denghausen's will, contends the money can only be used to operate the new library, after the town uses its own money to build it.

The existing one-story building is overcrowded and lacks space for collections granted in memory of Denghausen's wife, Luisita. So the town wants to use Denghausen's bequest to convert a former elementary school into a new library.

The town library trustees contend the Smithsonian is attempting to block the building of the library so it can obtain the town's $1 million. The Smithsonian already is expected to receive $4 million to $5 million from the Denghausen estate. It also received $3.8 million from Luisita Denghausen's estate.

The issue is now before an Essex County Probate Court. Denghausen, who was childless, died Oct. 17, 1987.

The Smithsonian and library trustees disagree over a passage from the will that said the money is intended "for the purpose of providing an adequate replacement for the now obsolete Carnegie Library."

The will said the money would be granted "provided that the town contribute the land upon which such a library is to be erected or provide the funds for the renovation of some building now owned by the town... ."

Residents at the December 1988 Town Meeting voted to give land and a former elementary school building to the trustees and voted to spend $15,000 on plans.

But Elaine Johnston, the Smithsonian's assistant general counsel, said, "The actions proposed by the town seem inconsistent with the terms imposed by Mr. Denghausen, and the Smithsonian feels a responsibility to ensure that his wishes are carried out."