This article on Wikipedia claims that Germany and the Soviet Union conducted talks over the possibility for the Soviet Union to join the Axis.
talks occurred in October and November 1940 concerning the Soviet Union's potential entry as a fourth Axis Power during World War II
However until now I knew that those talks were about a non-aggression pact and the definition of spheres of influence to avoid conflict. Non-aggression is way different from an alliance.
Stalin himself wrote a book to justify those talks when they were revealed after the war. The book is strongly biased, but still from it we can see the attitude of the Soviet Union towards Germany and it was a lot more based on confrontation than friendship. Stalin repeatedly talked about advancing the border to create a buffer to better protect them in case of war. This probably was a pretext to justify that expansion, however it is clear that both the Germans and the Russians were aware that their relation were not friendly enough for an alliance.
According to @MarkJohnson the Wikipedia article quoted a book by Nekrich and Moiseevich*. I don't have access to that book and I don't know whether the quote is correct. But anyway my understanding is that Germany and the Soviet Union were at odds over the control over Eastern Europe, too much at odds for an alliance. What evidence do we have that an alliance was really considered?
Note: I am not confusing the dates as claimed in the answer by Alex. I am referring to the second round of talks, which were kept secret and revealed only after the allies found the related documents in the Nazi archives after the war.
*Nekrich, Aleksandr Moiseevich; Ulam, Adam Bruno; Freeze, Gregory L. (1997), Pariahs, Partners, Predators: German–Soviet Relations, 1922–1941, Columbia University Press, ISBN 0-231-10676-9