IT MAY COME as a shock, but the National Security

Agency has even been listening in on the pay phones at Grand Central Station. "Hello, honey? Yeah, I'm sorry it got so late, but I missed the 5:42, and I went into the Oyster Bar to have a martini, and then . . ."

One can easily imagine conversations like these clacking out in six-ply, multicolored paper on those crypto machines in the basement at Fort Meade, Maryland, being rushed to the analysts in W Group, run through Cray-1, NSA's monster computer, and carefully studied for hidden meanings. Have the Russians invented a new code? Should the president be informed through the CRITICOM network? Or is it just another hapless commuter in trouble with his wife?

Of course, he might not be safe from eavesdropping even inside the Oyster Bar. A few years ago, it was revealed at a congressional hearing that government agents could bug the olive in a martini, hiding a tiny transmitter where the pimento should be. Just don't bite down too hard.

The news about Grand Central is only one small nugget buried in the gold mine that James Bamford's astonishing book on what is correctly subtitled "America's most secret agency." It is also a frightening book, because as Bamford points out, the biggest of America's secret intelligence agencies -- with the technology to intrude not only into the pay phone, but the bedroom, the boardroom, and any place it wants to listen -- was not even created by law. It was born, swaddled in secrecy, by an executive order signed by President Truman in 1952 that itself remains top secret three decades later.

There has always been a certain ostrich-like, head-in-the- sand quality to NSA's cult of secrecy. Anyone who has read the newspapers, or books, or watched television since Harry Truman signed that order is certainly aware that NSA makes U.S. codes and breaks the codes of foe and friend, vacuuming electronic signals out of the ether with its overhead satellites, and its dish antennae at listening posts girdling the globe. And most folks who drive along the Baltimore-Washington Parkway have probably noticed the signs for Fort George Gordon Meade, where NSA has been headquartered since the late 1950s. Yet the mere mention of the words COMINT (communications intelligence) or SIGINT (signals intelligence), the twin grist of NSA's mill, sends normally talkative government officials into a kind of prayerful, mystical silence. NSA, which some say stands for No Such Agency, successfully preserved its aura of secrecy.

Until now. There is a marvelous scene in one of the late Peter Sellers' Pink Panther movies in which Sellers, as the bumbling Inspector Clouseau, inadvertently demolishes a magnificent Steinway. "But that's a priceless piano," someone protests.

"Nut eny more," Sellers intones in his mock-Gallic accent.

So it is with NSA's secrecy now that James Bamford, a lawyer turned investigative reporter and writer, has given us The Puzzle Palace. NSA will never be the same.

Unlike Peter Sellers, Bamford has not destroyed the grand piano. He has merely shined his brilliant spotlight into some murky, neglected corners of our government. His critics will charge that in the process he has harmed U.S. security; it can be safely assumed that self-appointed patriots will denounce Bamford's daring book. But the Soviets (not to mention our allies, whose communications NSA also intercepts) are well aware that the United States is listening. So do they. Only the American public, which pays for NSA with its taxes, has been kept in the dark.

NSA is a vital agency, but it cannot expect to operate in total, monastic secrecy in a democracy. Nor should it -- a point that requires emphasis, because, in the past, at least, NSA has turned its big ear inward and violated the constitutional rights of Americans.

The Puzzle Palace was a book waiting to be written. In 1964, Thomas B. Ross and I included a chapter on NSA in our book, The Invisible Government. Three years later, David Kahn, in his comprehensive work, The Codebreakers, provided the first detailed account. In the congressional and other investigations that followed Seymour M. Hersh's 1974 revelations of CIA domestic spying, NSA officials for the first time had to testify in public, and the agency came under increased scrutiny. The Senate Intelligence Committee under Frank Church revealed that NSA, with the cooperation of three cable companies, had been reading international cable traffic in and out of the United States for decades in Operation Shamrock. The committee also described Operation Minaret, in which the names of American antiwar activists such as Jane Fonda and Dr. Benjamin Spock were placed on "watch lists" so that NSA could eavesdrop on their conversations.

But it remained for Bamford to provide the first in- depth study of the code agency. Although the style is uneven and occasionally overdramatic, this is a serious work, exhaustively footnoted and indexed. In compiling his study, Bamford used the Freedom of Information Act to dislodge copies of NSA's in-house newsletter, which proved a rich source of material for the author. Apparently he won NSA's confidence for a while, enough to be provided with a tour of the agency's headquarters. And he interviewed former NSA officials, obtaining cooperation in particular from former NSA director General Marshall S. Carter and Francis A. Raven, a former senior NSA official in charge of breaking the codes of Third World nations.

Bamford describes NSA's far-flung listening posts and secret installations, from a spooky "research facility" on Kent Island in the Chesapeake Bay, to Pine Gap at Alice Springs, in the Australian Outback (an installation that became a controversial political issue in Australia), to Menwith Hill, England, which NSA operates in close cooperation with GCHQ, the British code agency.

Perhaps most startling of all is his description of "the world's biggest bug," a giant ear "the shape of a dish sixty-six stories tall and six hundred feet in diameter -- wide enough to hold two football fields," hidden away inside a special "radio quiet zone" in Sugar Grove, West Virginia. Bamford speculates that the dish is designed to eavesdrop on the commercial COMSAT facility nearby in Etam, West Virginia, which handles half the traffic that passes in and out of the United States each day. "From their secret site five miles north of Sugar Grove, the NSA dishes should be able to pick up every earthbound whisper destined for Etam, as well as every pulse sent skyward." According to Bamford, three other NSA installations in Winter Harbor, Maine; Yakima, Washington, and Two Rock Ranch, California, may also be beamed at nearby COMSAT facilities.

There are some doubtful assertions in the book. Bamford states that NSA may be the only agency in the government "without a public information officer." However, a telephone call to NSA, asking for comment on the book -- particularly on the suggestion that Sugar Grove eavesdrops on COMSAT -- was answered by a woman who identified herself as "Mrs. Carolyn Johnson" of "the information affairs office." That's about all she would say, however. "We're making no comment on the book," she said. Would General Lincoln D. Faurer, director of NSA, care to comment? "No," said Mrs. Johnson.

Also, Bamford is correct that the FBI, at the request of the CIA, placed a bug in a foreign embassy in Washington in 1971 and that the CIA asked that the operation be halted in 1972 after FBI director J. Edgar Hoover threatened to preach to Congress about it. However, the embassy in question was not South Vietnam, as Bamford speculates, but Chile.

These are relatively minor quibbles. The Puzzle Palace is an important, fascinating book about secret power. And the stakes are high. An NSA ferret mission along, or across, a Soviet border could trigger World War III. At home, the agency's mind-boggling technology, if ever harnessed by a political despot, could leave us, as Senator Church once put it, with "no place to hide."