After being fachist basically since he was put in power then randomly in 1930 he decided to swich randomly going against what he belived in. 🤨
I'm not sure what you mean by Stalin being a fascist unless you are just erroneously using the term Fascist to mean dictator. /u/depanneur goes into detail [here] (https://www.reddit.com/r/AskHistorians/comments/5i1onm/why_are_communism_and_fascism_generally/db73312/) why Stalinism and Fascism are not the same ideologies, and attempts to define and contrast fascism and socialism in [this answer] (https://www.reddit.com/r/AskHistorians/comments/22ox1w/what_is_fascism/cgoz902/). If you are referring to the Molotov-Ribbentrop pact, in which Stalin and Hitler essentially cooperated in dividing up Eastern Europe, /u/kieslowskifan provides context to this cooperation [here] (https://www.reddit.com/r/AskHistorians/comments/4d1hx3/how_did_russiaussr_justify_the_molotov_pact_with/). It's worth noting that Stalin and essentially every prominent Bolshevik in the USSR were incredibly anti-fascist in rhetoric, viewing the right-wing ideology as a major threat to leftism. Infamously, Comintern leaders like Stalin even slandered Social Democrats, who are center-left on the political spectrum, as Social Fascists due to their resistance to revolution and adherence to the bourgeois class structure and capitalist system.
I believe there is some mixup about official terminology and actual actions.
First, the terminology
Officially, Stalin was communist and against fascism, and the fascists were against communism.
Looking at the broad definition fascism, however, Stalin and his administration were always pretty close to fascism. So much so, that his approach to government is sometimes referred to as "social fascism."
Stalin himself described fascism and social democracy as "twin brothers." He then went on to claim that fascism depends on the active support of social democracy and that social democracy depends on the active support of fascism. Although in reality neither he nor the fascists liked actual democracy of any type, the acknowledgement of the overlaps reflects an understanding that there were some actual similarities.
Both fascism and Stalin put the nation above the individual, had a centralized, autocratic government with a dictatorial leader, very strong social and economic control, and the use of force to crush opposition.
The most visible difference is economic, but also in the idea of what is an acceptable population. Communist ideology promises to end racism and aimed to spread communism to all people, worldwide. That does not have the racial component in its ideology that fascism often does.
However in Stalinist practice, Russian ethnicity and even more so, language and culture, were held as the goal for all other to adopt. Minorities received lip serve to autonomy and titular regions under Stalin, but that was performative. Minorities could dance the dance and wear the hat that the center determined was the "correct" one, but any real structures were deliberately designed in a way to weaken any actual ethnic power blocks and ensure their dependence on Moscow. Any real ideas of national self-determination or even strong identity were crushed to prevent alternate power bases from arising, sometimes proactively.
That is how you get a Tartarstan with more Tatars outside of its borders, Koreans deported to Central Asia, the end of the ancient Greek minority within the USSR, etc.
That doesn't sound like the genocide of the fascists, but for the millions who were killed or sent to gulags for being anything less than 100% excited about a Moscow-based life, or who died in the mass deportations of entire ethnic groups, or who suddenly found themselves an unwanted minority surrounded by new Russian neighbors, this still quite difficult.
Now, the actions
Stalin did not live or rule according to actual communist or socialist ideals. He lived according to whatever he thought kept Stalin in power first, and strengthened the USSR second.
If that meant brining in the mega capitalists, and paying them mega bucks, to develop Soviet oil fields, or build factories, so be it (un-fun fact, that's the beginning the Koch family fortune. Daddy made his first millions building oil refineries for both Stalin and Hitler).
If it meant pretending to allow elections, but being the only choice, assassinating rivals and instituting a great purge that killed millions, also fine.
If it meant that he would create a wonderful-sounding constitution, but also decide in advance, before anyone could even commit a real crime or be a real spy, how many slave labor prisoners he would need for that year's industrialization plans, also cool.
If that meant, in the 1930s, working with Germany and even the Nazis to help them evade restrictions on developing the military in their own country following WWI, that was fine. If it meant allying with the Nazis, and even dividing Europe with them, and killing anyone in those countries, should they oppose this? No problem here!
On to the fascists (in Stalin's case, mostly the Nazi Germans)
That collaboration was not because of Stalin's actual love of fascism or being a fascist though. It was a policy that came from a combination of understandable fears and imperial murderousness. The partnerships with Germany started before the Nazis took power, but continued and even expanded after they did.
Stalin, and the USSR leadership, recognized that years of civil war, famine both natural and created, upheaval, purges, and the killing of scores of officers did make a strong economy or military. They also realized that Russia was far less industrialized than other rival nations, including in the military sphere. They realized that they were not in a position to win a major war, and that they needed outside help to get there.
The hope in being friendly with the Nazi government, was they could use that time to acquire technology and skills from the Germans, and use that, along with the time that it bought before a major conflict, to build Soviet capabilities to a point that they could have a hope of winning any future wars. In the mean time, the Soviets and Nazis could divide spheres of influence, and the Soviets could build their power while the Nazis went to war with other European powers, and they could all weaken each other with that fighting.
They also hoped that this European war - without the USSR - could cause such social upheaval, that communist revolution would be possible, and that the USSR could help that along when the time came. That way, the USSR would be the most powerful country in Europe, and from thence, the world?
For a time, it even looked as if this might be happening - the Nazis took half of Poland, the Soviets the other. The Nazis also agreed that that Stalin could take the independent Baltic states of Latvia, Lithuania and Estonia (they pushed the Soviets out during brutal fighting in the 1920s), occupy part of Finland (another former imperial holding that was now independent) and dominate Romania. The Soviets invaded Finland (and did badly for reasons not entirely unlike why they are doing so badly in Ukraine today). The Nazis invaded France and the war began in W. Europe and N. Africa. A reasonable person could be forgiven for expecting the Nazis would choose to only fight one war, on one front, at a time.
This was realpolitik, with the end goal of communism - and the USSR - replacing fascism in the then-fascist countries, not any love for the fascists themselves, or even any acceptance that fascism could also have a long-term place in Europe.
The change
What changed that approach was the surprise attack on the USSR, by Nazi Germany. Stalin does not appear to have believed that Germany would attack. He ignored evidence to the contrary, even when collected at great personal cost by spies such as Richard Sorge (Stalin also refused to intervene to help Sorge when he was arrested for espionage and executed in Japan. For Stalin, it was better if that Sorge not return home to tell anyone how his warning about imminent invasion was ignored). As the story goes, when he heard the news, Stalin said, “everything that Lenin built, we shit away” and went on a multi-day bender.
Once he was back in control, however, Stalin was now vocally anti-fascist. The Nazis were the fascists, the fascist were the invaders, and both were bad. This did not affect Stalin's preferred style of government - he retained the aforementioned aspects of fascism - but the USSR had no fascist allies or friends anymore.
Some sources:
Moorhouse, Roger. The Devils' Alliance: Hitler's Pact with Stalin, 1939-1941
Rimer, J. Thomas. (ed.) Patriots and Traitors, Sorge and Ozaki
Drieu La Rochelle, Pierre, Fascist Socialism - you might like this one. It was written in 1934 and offers a contemporary comparison
Kravchenko, Viktor - I Chose Freedom - an autobiography by a Soviet defector who describes his life in the USSR at the time
Snyder, Timothy, Bloodlands: Europe Between Hitler and Stalin
Uldricks, Teddy - Stalin and Nazi Germany - article with an online preview, talks about social fascism