Stalin was trained for the priesthood. Trotsky expressed admiration for the Jesuits.
But there is a kernal of truth in the linkage: both widespread atheism, and Marxism, are products of the Enlightenment, that great opening of the human mind, when people began to apply reason to the world around them.
Marxism arises from the attempt to analyze and understand history and social evolution: where our society came from – as opposed to just assuming it as an eternal given. Atheism comes from the same impulse, applied to the physical universe. It’s really a relatively minor characteristic of the scientific approach to understanding how everything works.
So Atheism and Marxism are distant cousins. Another cousin is the concept of the limited-government, democratic republic.