There's a secret city in Washington, walled-off and mysterious, yet open to the public.

For 162 years it was a principal arsenal of our democracy, first a shipyard and then a clangorous hell of smoke and sparks where craftsmen forged mighty guns. On sea and shore the United States imposed its will largely by the weight of metal thrown -- or that could have been thrown -- from massy barrels stamped U.S. Naval Gun Factory.

Now the forges are cold and the factories silent and it's simply the Washington Navy Yard, given over to ceremony, bureaucracy and naval stores. But the grounds and buildings, some dating back past the yard's founding in 1799, are largely unchanged, preserved by tradition, inertia and designation as a national historic landmark.

It's fascinating compound, well worth the investment of a full day's exploration. During the moments when there are no cars or trucks moving down the ancient streets and alleys, it's possible to imagine that just round the corner you'll encounter Mr. Lincoln strolling with Admiral Dahlgren, discussing a new gun design or Union naval grand strategy.

It's strictly a do-it-yourself tour, for there isn't even a decent map available, much less guided tours. But many of the major buildings, once you find them, have informative plaques, and the Navy Yard is full of smart-stepping sailors and marines who seem to be constitutionally kind to strangers.

Necessarily and unfortunately, such land-marks as the EXPERIMENTAL MODEL BASIN, where hull designs once were tested, can only be viewed from the outside. There are, however, two large outdoor displays and a pair of excellent museums.

The LEUTZE PARK GUN COLLECTION surrounds the parade ground and consists of muzzle-loaders captured during the 19th century. How and where they were seized is lost in the mists of time, but the plaques are otherwise succinctly informative.

Facing the parade ground are LATROBE GATE, built in 1805; TINGEY HOUSE, residence of the Chief of Naval Operations; the SECOND OFFICER'S HOUSE, oldest structure on the grounds; and the MARINE CORPS MUSEUM.

The marines' museum is just what you'd expect, trim and taut. It covers a lot of historical ground in the space available, and has been significantly improved recently by the addition of yet more deadly attractive gear and guns. There remain two major shortcomings: Short people are not going to be able to see some of the most fascinating displays unless they're accompanied by strong people who can lift them up (surely the Corps could lay its hands on a dozen simple stools); and the lighting ranges from inexpert to atrocious.

Go back across the foot of Leutze Park and look downhill toward the Anacostia and you'll see the gorgeous OLD COMMANDANT'S OFFICE (1838), now serving as a visitor center, among other things. Inside are models of the Navy Yard during various periods and also helpful people who'll give directions and, if they can find one, a walking-tour brochure that isn't very helpful because it has no street names or building numbers. The Navy employs some of the world's most respected military historians; it's a shame none of them has produced a guide for visitors to what once was one of the world's leading centers of ship and weapons design.

Opposite the visitor center is the COMBAT ART GALLERY, open weekdays only, displaying just what the name suggests, but in a surprising range of styles and techniques; good-quality prints of most of the works are for sale at $3 to $5.

A few steps farther along toward the river is the impressive and mysterious WILLARD PARK NAVAL WEAPON COLLECTION. Impressive because it has some wonderful ordnance in it, including a humongous 16-inch gun barrel. Mysterious because most of the items are unabeled. "We're upgrading the park and pretty soon will have a complete set of labels and explanations," a Navy spokesman said. That's exactly what they said last year, but no matter; it's big neat stuff, and kids will love it.

Abutting Willard Park is the NAVY MEMORIAL MUSEUM. They closed it for renovation last year and those of us who have long regarded it as the best museum in Washington bated our breaths for fear they would ruin it. It's a pleasure to report that it's still pretty much the mad and mighty jumble it's been since they threw it together in 1961 on orders of Admiral Arleigh ("31-Knot") Burke, then Chief of Naval Operations and said to be the last man who really ran the U.S. Navy.

What makes the Navy Museum so fine is that it's the Navy's attic, and going through it is like inspecting the dusty treasures of some heroically adventurous and eccentric ancestor. First, last and always there are the ship models. Great big ship models, tiny ship models, one in silver and gold, a fleet of seven carved entirely (sails, spars, rigging and all) from ivory by a crazy Frenchman (his own description) named Roger Brejouy Four of them are of the same vessel; each took thousands of hours. Vive la france!

There's a submarine room where you can sound the dive klaxon and inspect the Anacostia through working periscopes. There are big guns you can climb on, with the elevation and training gear still operable and nobody telling you not to operate them.

There's a mysterious electronics cave, full of dark cases that have buttons to push to make the displays operate. None of them works. There's a bathyscaph you can climb into, and full-scale models of the Hiroshima and Negasaki atomic bombs (the triggering devices were made at the Navy Yard) you can shudder to touch. There are odd lots of items whose presence can only be explained as the whim of some brass hat or his lady. There's the breadcrumb chess set a Vietnam POW made to keep from going nuts.

There is, in short, such an endless and engaging array that one visitor who entered at lunchtime last week emerged from quiet contemplation four hours later to realize that they'd closed the museum and locked him in. WASHINGTON NAVY YARD -- At-Ninth and M streets SE (Sixth Street exit from the Southeast Freeway). Plenty of parking's available, unless they're retiring an admiral or something. MARINE CORPS MUSEUM -- Open 10 to 4 Monday through Saturday, noon to 5 on Sundays and holidays. Open Wednesday and Friday evenings during the summer. 433-3534. NAVY MEMORIAL MUSEUM -- Open 10 to 5 weekends and holidays, 9 to 4 weekdays. 433-2651.