It was espionage writers who convinced most of us that spying is a dirty business, no matter what side you're on. Even John Le Carre's poor old George Smiley did things he wouldn't want to write home to mother -- his real mother -- about, and his KGB counterpart Karla shared more than a career choice with the British intelligence chief.

So why are we surprised when Ronald W. Pelton is charged with betraying a high-tech, highly successful U.S. eavesdropping operation? Why are we surprised when John Anthony Walker Jr. pleads guilty to selling cryptographic paraphernalia to the Soviets?

We're surprised, all right. We're downright shocked.

But some of the writers whose flawed heroes and noble enemies have kept millions reading into the wee hours or quivering at the edges of their cinema seats will tell you they knew it could happen all along. Spy vs. Agent

"Let me tell you something about terminology," says Tom Clancy, author of "The Search for Red October."

"A guy who works for the Central Intelligence Agency is an 'officer.' The foreign national he recruits to work for him is an 'agent.' And the guy working against us, for the other side, is a 'spy.'

"Traditionally, the Russians make pretty good spies," Clancy says, but "the thing they have working against them -- well, let's say you're a KGB recruit. What you see on Russian TV is the Ku Klux Klan and poor miserable people, all this while they're teaching you 'what you need to know.'

"Then you come to this country and see what it's really like, and that has to be really disorienting. Take a supermarket, for example. They don't even have the concept."

For strongly ideological reasons, Clancy believes that "because we have the truth on our side," the Russians lose a lot more officers and agents than we do. He pauses briefly at the thought of Vitaly Yurchenko, the KGB colonel who asked for asylum here last summer, turned over a passel of his "agents" and then, in an apparent amorous contretemps, returned to the Soviets in November.

"Oh," Clancy says, "I'm sure he's dead by now." Spy vs. Spy

"There are, generalizing very crudely, of course, two kinds of spies," says novelist W.T. Tyler ("The Ants of God," "Rogues March"), who is also retired U.S. foreign service officer Samuel Hamrick. "One spies for ideals and principles, and the other for material things like money.

"Now the difference between the two is the difference between, well, maybe a professional and an amateur. But let me put it even more crudely -- the difference between a courtesan and a prostitute.

"Both sell themselves, but the courtesan is really imperial property. She belongs to the court and she stays in place. But the prostitute wanders. She sells herself one night at a time, and you never know where she will be tomorrow. It's a very crude distinction, but it is something you should keep in mind, because intelligence services distinguish on the same sort of basis.

"They make their distinctions a little bit more gentlemanly, of course. That is to say, an agent who spies for ideals or principle is controlled by what they call 'positive factors.' The agent who isn't moved so much by principle, who works like the prostitute, presents problems because he's motivated by what the services call 'negative factors' -- I mean the need for money, or women, or grudges or resentment -- and these are pretty fickle motives. They can change overnight, like Yurchenko changed.

"They are very difficult to control. Once his motive is gone, so is he." Spy of the Month

James Grady, author of "Six Days of the Condor" (shortened to "Three Days" in the movie) and "Hard Bargains," sees the spy of the '80s as a logical extension of the "me" decade.

It's a "new kind of cynicism," he says. "You see more now because the market is bigger and the opportunity greater. And despite the Reagan revolution, the era of ideological purity is gone . . .

"Nobody thinks anything he does is going to change the course of history, although spies used to feel that way. But since the splitting of the atom, they kind of see themselves outside of the ebb and flow of civilization." Now, he says, "getting your money or your kicks that way is an act of psychic rebellion against an anonymous society where even your betrayal is pretty meaningless."

The spy-of-the-month phenomenon, says Grady, reflects "the sort of overkill mentality of the intelligence communities, where the idea of careerism is the most important element. The Soviets are paying for information they probably don't even want.

"Intelligence works this way: An officer advances his own career by recruiting agents. If the agent is a jerk, it doesn't matter, because it doesn't make the statistical flow charts. It's a Dale Carnegie nightmare.

"I've dealt with some of the real old ideologues who actually joined the CIA and the FBI to fight the evils of communism, but now you see American oil companies in league with the Angolan Marxists, and it becomes a little difficult to draw those lines anymore. Labels are meaningless.

"At the end, maybe, espionage will be a much cleaner game, but until then what you have, basically, is one bureaucracy fighting another bureaucracy for almost the fate of the world." Supply-Side Spies

Today's spies are "untraditional" for a number of reasons, Tyler says, "but not really new. Most spies or agents are grubby and unreliable, the kind who are moved by negative factors like money.

"In fact," he says of the recent crop, "they weren't so much agents as self-starting hustlers. They saw their opportunities and they capitalized on what access they had.

"They were," he says, "supply-side agents out for a quick turnover -- spot traders. They wanted to turn a quick profit and get out. That is completely different from the traditional spy, a little guy who stays in place, year after year. No Mercedes, no Jacuzzi, no mistress, just a brownbagger -- and he's still there . . .

"So there is nothing really new about these agents that have turned up with such frequency. They've always been there, and are essentially the meat and potatoes of the intelligence trade."

Tyler points out that most of the alleged spies arrested in the last year -- the Navy's Walker-Whitworth gang, for example, and Pelton, the retired National Security Agency communications specialist, "were no longer government employes and no longer had direct access to secret materials when they were in contact with the Soviets.

"In fact," he says, "they joined the service for the reason most people joined the military -- they were looking for government careers. It just so happened that during the course of their careers, they discovered the stuff they were dealing with had a pretty high value out in the free market." Entitlement Spies

"Now," says Tyler, "let's put all this in perspective in terms of the times.

"Because," he says, pausing, "there is a perfectly respectable precedent for what these guys did. It's what I call the Washington Limousine Executive Entitlement program.

"What it really means is that any Washington executive or politician, those entitled to limousines by the nature of their offices -- secretary of state, chief of naval operations, national security adviser, for example, even an ex-president or so -- has a God-given right, after he leaves office, to sort of capitalize on his experience and to turn his recollections and his expertise into hard cash."

Tyler warms to his explanation. "This," he says, "is what let Henry Kissinger take all this classified and semiclassified stuff with him when he left office so he could rewrite recent history for us. It's the same thing that sends the admirals over to General Dynamics after they finish in the Pentagon . . . Alexander Haig, David Stockman selling all those years of gnawing frustrations to a publishing house.

"There is also a much less respectable counterpart to this sort of entitlement program, you really don't hear so much about it," he says. "It's really a sort of blue-collar entitlement program, because these guys have no real entitlements except a pension and maybe some VA benefits.

"These are people like the former Green Berets . . . who peddle their combat experience in El Salvador or with the contras . . . chief executive officers with high overseas exposure who do business with the Arabs . . .

"But," Tyler continues, "particularly in the case of Pelton, who admitted approaching the Soviets after he left the agency, he essentially sold his memoirs -- doing the same thing, at a much cheaper price, as Kissinger was doing." Spy vs. High Tech

Finally, Tyler says, it is the immensity of the military-industrial complex in this country that provokes the massive Soviet espionage effort.

"The Soviet effort is really the price they pay for their own technological backwardness," he says. "What bothers them is that things may be happening in U.S. technology from Massachusetts to California which they can't really contend with . . .

"Some little shop scientist at Honeywell is working on a new microwave oven and he comes up with a hand-held laser beam that can zap Moscow from Macy's basement.

"And that," pronounces Tyler, "is what really scares the Soviets."