THE FREUD SCENARIO By Jean-Paul Sartre. Edited by J.-B. Pontalis. Translated by Quintin Hoare. 549 pp. Illinois: The University of Chicago Press. $24.95.

JEAN-PAUL SARTRE liked going to the movies because it was an unstuffy, proletarian thing to do, but when it came to writing for the movies he showed himself as intellectually lordly as ever and produced a scenario that was quite brilliantly unmakable. Asked in 1958 to do a script about Freud by the director John Huston, Sartre wrote a synopsis of some 95 typed pages; this Mr. Huston accepted, and Sartre went to work (or to town) on a shooting script. Like the synopsis, it was on the long side; had it been shot it would have worked out at some seven hours of screen time, and seven unusually exhausting hours for simple moviegoers, untrained for the fiercely cerebral and ambiguous story Sartre had to tell. He was asked to chop and to change this first version, which he did with his usual freedom, with the result that the revamped version was longer still. He and Mr. Huston could anyway not get on together, and by the time a film was finally made Sartre had moved on; he asked not to be credited, even though it seems that ''Freud,'' the second-rate outcome of their doomed collaboration, still showed faint signs of his boisterous work on the script.

Why on earth, one wonders, did Mr. Huston go to Sartre in the first place? Sartre had written for the stage, but he had also written ''Being and Nothingness'' and ''The Critique of Dialectical Reason'' and there was a fair chance that any movie script by him would be too philosophical and too long for any known audience. What is more, Sartre was notoriously cool toward Freud and a great disbeliever in the unconscious, which he thought could at best be a misnomer for what we don't understand about ourselves. He had offered his own so-called existential psychoanalysis as an improvement on the Freudian kind, as truer, less Procrustean and more individualized, seeking to identify in every case history the fundamental and all-explaining ''project'' of a unique human life.

As it stands, however, ''The Freud Scenario'' is not especially hostile to Freud, if it is not so very flattering to him either. It follows the cardinal 10 years or so when he slowly realized his distinctive purpose and method in psychotherapy; and understanding one's purpose is a Sartrean theme. Here Freud is making himself or finding out what his determining project is, and that means primarily freeing himself from the influence of others. So two great dramas are afoot simultaneously, and Sartre treats both consummately. In one, the still tentative Freud is liberated from the coercive presence of such colleagues as Theodor Meynert, Josef Breuer and the tough guy Wilhelm Fliess, whom Sartre makes quite devilish; in the second, a number of variously unhappy female hysterics are treated or resoundingly healed by the evolving Freudian method. By the end Freud is Freud, now in his early 40's, autonomous but also alone, godless and fatherless, an existentialist hero.