The image of Communist General Secretary Santiago Carrillo as a tolerant anti-Soviet Eurocommunist champion is suddenly losing its gloss here because of a best selling Spanish book charging Carrillo with ruthless "Stalinist" domination of the party when it was a persecuted underground organization conspiring to topple the late dictator Francisco Franco.

There is no doubt that Carrillo and the party's leadership have been shaken by the allegations in the acidly critical "Autobiography of Federico Sanchez," by Spanish novelist and screenwriter Jorge Semprun, who was ousted by Carrillo in 1964 from the party's executive committee.

For months the Spanish Communists have been enjoying the triumphs of acceptance in Spain and in the West, including the United States, because of their brand of eurocommunism under which most of the parties in Western Europe have taken an independent line from the Soviet Union on key issues.

Carrillo's standing has become so high, in fact, that he has been received by King Juan Carlos I. Last fall he lectured at several leading universities in United States. He was the first Western European Communist leader to be given a U.S. visa under new immigration regulations.

Until Semprun's book hit the best-seller list, it was a s if neither Carrillo nor the Spanish Communist party had a past closely linked to the Soviet Union. The party's role in the 1936-39 civil war was buried - and so was its liquidation of other leftist forces during the conflict and its fealty to Stalin.

Semprun's intensely emotional attack on Carrillo, the party and Stalin opens wounds, memories and a history that most Spanish Communists would like to forget.

For them, it was if the party was born anew in April when it was legalized and when it acquired a new philosophy with the publication of Carrillo's "Eurocommunism and The State," a theoretical work that aroused Moscow's wrath.

What gives Semprun's book force is that he is no ordinary writer. He wrote the screenplay for "Z" and other award-winning leftist movies. He writes in Spanish as well as French and his novels have won prizes in Spain and in France. But for years - particularly in the 1950s - he entered and left Spain, where he headed the Communist underground, as Federico Sanchez, his party identity.

He joined the party as a teen-age while in exile in France, fought in the French Resistance during World War II, and was captured and interned in Buchenwald. These credentials, apart from his literary ability and position in the party give his book special political significance.

Carrillo declined to comment on the book when questioned yesterday.

"I will not give it any publicity," said Carrillo.

Still the party's weekly newspaper, 'Mundo Obrero, in its latest issue, admits that the book will "hurt" the party because of the "calumnies" it contains. And the party's chief theoretician, Manuel Azcarate, has published a rebuttal of Semprun's recollections.

What appears to hurt the Communist Party's chiefs most is Semprun's accusation that Carrillo virtually sent Communist underground leader Julian Grimau to his death when the general secretary made Grimau the top Communist leader in Spain. Grimau was captured by Franco's police and executed in 1963 despite pleas for clemency from all over the world. He became a martyr to leftists the world over.

Semprun recalls that he had warned Carrillo that Grimau was unfit for the task because Grimau was careless and took too many risks. But what spelled death for Grimau, says Semprun, was that he had worked for the police of the Republic which Franco defeated in the civil war.

The author, reached at his Paris home, said in a telephone interview that he considers himself "a freelance Communist" and "hopes that his book will help to open the party to democratic leadership and debate."

He blames Carrillo for a complete misunderstanding of what was happening in Franco's Spain as a result of economic progress in the early 1960s. His suggestion of a new line for the party - close the Eurocommunism espoused by Carrillo today - was the cause for his ouster in a party meeting in Prague in 1964. He was backed by Fernando Claudin, a Communist theoretician who has refused to take sides with Semprun in the present party dispute.

For Semprun - as well as for other intellectual Communists who left the Spanish party in the 1960s - Carrillo represents the Stalinist tradition that puts the party above all.

Carrillo and other party leaders are well aware of demands for open discussion within the party. Whether they intend to allow criticism will become known at the party congress next spring.