ONCE upon a time, wars and wars ago, there lived in the town of Nachod, Czechoslovakia, a 17-year-old tenor saxophone player named Josef Skvorecky. His homeland was occupied by Nazis. His heart was occupied by jazz.
Thanks to a wind-up phonograph, he knew Duke Ellington and Jimmy Lunceford. He heard Louis Armstrong struttin' with some barbecue. Glenn Miller put him in the mood. He would never get over Ella Fitzgerald.
When the Nazis prohibited that ''decadent American music'' - ''Judeo-negroid'' music, the Nazi propagandist Dr. Goebbels called jazz - the young saxophonist and his pals changed the name of ''Tiger Rag'' to ''Wild Bull'' and kept on playing it, in syncopated disguise.
After World War II the Nazis marched out, and Skvorecky and his tenor sax celebrated freedom from the bottom of his Czech-Dixieland heart. Only instead of the saints it was Soviet troops who came marching in, and before a fellow could blow a second chorus of ''Sweet Georgia Brown,'' Soviet commissars were calling jazz the ''music of spiritual poverty'' and ''dollar cacophony.''
About then the fast-maturing tenor saxophonist formulated Skvorecky's law: All kinds of dictators hate all kinds of art because ''art evades control - if controlled and legislated, it perishes. But before it perishes . . . it becomes protest.''
At this point Skvorecky switched from the tenor saxophone to the typewriter and became a novelist, composing a brilliant story, ''The Bass Saxophone,'' about a teen-age boy - a saxophonist - who stumbles upon a shabby little orchestra working its way across Nazi-occupied Czechoslovakia. The leader plays violin with a ''wildly fallible bow.'' The female vocalist has a voice ''like a cracked bell.'' Everybody in the band is a casualty - in music, in life. But shining and unimpaired, standing in the middle of the band, is a giant bass saxophone, waiting to be played, the way King Arthur's sword waited to be drawn from the stone.
When, with Nazi officers in the audience, the chosen musician appears and the bass saxophone soars into a solo beyond the repressive world of the police state - and indeed, beyond the conventional rules of music - Skvorecky's meaning becomes clear. Fascism is as hapless before an improvising sax as the Czechs were before a division of German tanks.
History moved on. Jazz lost favor with the young. Rock became the enemy of the state. In 1971 the commissars allowed the formation of the Jazz Section of the Czech Musicians' Union, limiting membership to 3,000 in a country of 11 million. What harm in that, when all the dangerous-and-the-decadent had abandoned the saxophone for the electric guitar and flocked from Dizzy Gillespie to the Rolling Stones?
But the Jazz Section began to expand its territory, getting into modern art. Furthermore, because of a loophole that did not require censorship of a government-sanctioned club's publications, the Jazz Section printed not only histories of jazz and rock but a satirical novel by the nonconformist Bohumil Hrabal.
In a recent issue of the New Republic, Skvorecky tells the whole story of how the Jazz Section played rings around the commissars, like a saxophonist dodging the melody on ''Tea for Two.''
After 13 years the commissars caught on, the Jazz Section was dissolved, and its resourceful leader, Karel Srp, has been threatened with a 14-year prison term. But Skvorecky does not see this as the end. In the profoundest sense he believes the beat goes on.
Skvorecky, now an emigrant professor in Toronto, has long since given up his dreams of becoming the Czech answer to Coleman Hawkins. But he confesses: ''To me literature is blowing a horn.''
His latest novel, ''The Engineer of Human Souls,'' takes its title from Stalin's phrase for what a Soviet commissar is supposed to be. But Skvorecky refuses to concede that these engineers will ever have their way - and jazz is one small reason why. Observing that jazz bands have played through the worst scenes of modern history - Siberian camps, Terezin's ghetto, Buchenwald - Skvorecky finds in jazz, as he found in the bass saxophone, a voice that cannot be silenced, a voice that is declaring more than the sum of its notes.
What tyrant is not prepared for military force? Against our guns, their guns stand an equal chance. But against a teen-ager with a tenor saxophone and an arrangement of ''Darktown Strutters' Ball''? For 40 years now, Skvorecky has placed his wager on the ''hope and love - and faith'' all music testifies to - on that young man with a horn.
A Wednesday and Friday column