Stockholm — Sweden's Socialist Prime Minister, Olof Palme, Wednesday accused the US Central Intelligence Agency of spying on him for ''several years.'' It is believed here that if the CIA put a tail on Mr. Palme, it would have been during his first term of office, from 1969 to 1976, when Sweden was fiercely critical of United States involvement in Vietnam and the scene of massive anti-American demonstrations.
In an interview with a leading evening newspaper, Kvallsposten, Mr. Palme was quoted as saying: ''I myself had a CIA agent on my heels for several years. We couldn't break off relations because of that.''
He was answering questions on Soviet espionage in Sweden at the time of his comment. Sweden recently expelled two Soviet diplomats and a Russian civilian for spying. Mr.Palme was asked why, under the circumstances, an official visit to Moscow next week by a senior Swedish diplomat was still going ahead.
It was then that he made his allegation about the CIA.
Palme's press secretary, Hans Dahlgren, said the prime minister would not be available to comment or expand on his accusation until Monday.