A nuclear weapon is extremely powerful; surely he would love to have one before America developed their own.
Stalin ordered research on nuclear weapons in 1942, in response to the probability of German, British, and American research. It wasn't seen as something that would lead to a bomb before the end of the war, so it was only a small program (which guaranteed that it wouldn't lead to a bomb before the end of the war).
A brief timeline of Soviet nuclear research to the program that developed their bomb:
December 1932: nuclear physics research begins in the Soviet Union. loffe, director of the Leningrad Physiotechnical Institut, set up a laboratory for nuclear physics. By 1934, this had grown to 4 laboratories, working on problems such as artificially radioactive nuclei (i.e., producing radioactive isotopes from stable isotopes). This wasn't research on fission, but it developed laboratories and researchers who could easily turn to research on fission.
December 1938: nuclear fission demonstrated by Hahn and Strassmann in Germany.
February 1939: Soviet researchers learn about nuclear fission (from foreign scientific journals). Soviet research on fission began very shortly afterwards, with research carried out in Leningrad and also Moscow and Kharkov. Most was basic science, but there was a vision of future work on nuclear power generation.
November 1939: the Fourth All-Union Conference on Nuclear Physics included a a large amount of nuclear fission (the fission section was the largest section of the conference).
June 1940: the Academy of Sciences created an Uranium Commission to direct fission research in the Academy. This resulted in more funding for research, and an expansion of research. The Uranium Commission decided to not seek increased funding from the government for an even bigger research program. The head of the Commission commented on an enthusiastic and optimistic lecture by another researcher:
It was too early to speak of the industrial generation of atomic energy. Some young physicists, in particular the students of the lecturer, were so captivated by uranium projects that they forgot about the needs of the present day. The lecturer had shown that if the isotopes of uranium were separated (and that was still unrealizable in practice) or if tens of tons of heavy water were accumulated instead of the existing tens of kilograms, then a chain reaction would become possible. But 'possible' and 'practicable' were not concepts of equal value. The practicability of a nuclear chain reaction had not yet been established even in the laboratory. Unfortunately, it had to be acknowledged that uranium energy was a distant prospect, still a beautiful dream. It was wrong to give oneself up to 'Manilovshchina', wrong to draw creative minds and national resources into unreal schemes.
November 1940: Soviet researchers discuss the possibility of a uranium bomb: possible, but expensive and difficult.
June 1941: the German invasion stops Soviet nuclear research. The researchers proceed to work on war-related research (degaussing ships to avoid magnetic mines, armour, etc.).
November 1941: At a conference, one researcher (Kapitsa), speaking about the contribution of science to the war:
Explosives are one of the important means of contemporary war. Science shows the possibility in principle of increasing the explosive force one-and-a-half to two times. But the recent past has provided new possibilities of using intra-atomic energy, the utilization of which was formerly written about only in science fiction. My personal opinion is that the technical difficulties which stand in the way of utilizing intra-atomic energy are still very great. This matter is still very doubtful, but it is very probable that there are great possibilities here. We are posing the question of using atomic bombs which possess huge destructive force.
Atomic bombs might be possible (but this wasn't certain), but there were immense technical obstacles. Essentially, there was a very good chance that research on a bomb would not lead to any results before the end of the war, and would be a waste of scarce resources.
May(?) 1942: Stalin summons key scientists and asks:
Could Germany develop an atomic bomb?
Why have scientific papers on nuclear fission stopped appearing in Western journals?
Conclusion: There is a good chance that Germany, Britain, and the USA are working on the atomic bomb.
Result: An atomic bomb research program was established before the end of 1942 (but work only really began in March 1943 - the price of the disruption of earlier nuclear research by the war). The more reliable predictions of the time that would be needed to develop a weapon were typically 10-20 years - this was not necessarily a project aimed at defeating Germany, but rather to not be too far behind in the post-war world.
EDIT: As u/restricteddata wrote, the Soviet wartime bomb project was small-scale. There were three main goals:
Achieve a chain reaction in an experimental pile. One project was to build a pile using heavy water as a moderator, and another using natural uranium with graphite as a moderator (one of this type achieved a chain reaction in December 1946).
Develop methods of isotope separation. There multiple projects: electromagnetic, gaseous diffusion, and thermal diffusion.
Study the construction of a bomb - a theoretical study based on results of work on the first 2 goals. An answer to the questions "What resources do we need to build a bomb, and how long will it take?" would have been a desirable outcome.
u/restricteddata described the wartime Soviet program as "exploratory", but the actual goals correspond closely to the "pilot" phase (but these "pilot" goals were not achieved before the end of the war, so "exploratory" is a fair description).
August 1945: Stalin spoke:
A single demand of you, comrades, provide us with atomic weapons in the shortest possible time. You know that Hiroshima has shaken the whole world. The equilibrium has been destroyed. Provide the bomb - it will remove a great danger from us.
and the much larger-scale program that developed the bomb (in much less than 10-20 years) began.
Reference:
Holloway, D. (1981), "Entering the Nuclear Arms Race: The Soviet Decision to Build the Atomic Bomb, 1939-45", Social Studies of Science 11(2), 159-197: http://www.jstor.org/stable/284865
One can divide a nuclear weapons program in several distinct phases that are characterized by somewhat different activities and radically different expenditures of resources.
The first is the exploratory phrase, which is a program meant to answer the question of, "can this be done, and if so, how should we do it?" This is largely something done on paper and laboratory-scale: you need raw data, you are making estimates, you need to know what's already in the public domain (or can be acquired through espionage), and so on. In the US this was the Uranium Committee phase of the work (1939-1941), in the USSR, this was what was being done during the war itself. (This is essentially the phase that Germany was in for the entire war.) This is a relatively small-scale effort: the staff measures, at most, in the hundreds, and the money is relatively trivial (maybe a few million dollars, which is nothing from a scientific research standpoint). The output of the exploratory phase is information: stuff that can be written on paper, in reports, that tells you what to do next.
The second phase, which can bleed very closely to the first phase in practice, is the pilot phase. This is when you think you know how it ought to be done, but need to prove that your assumptions are correct before you scale it up to the next phase. This involves more impressive expenditures of money and human resources, as you start to build, at a smaller scale, the kinds of facilities you will need to enrich uranium, breed plutonium, and so on. In the US this was the S-1 Committee phase (note that the name changed to something far more obscure as the work started getting more serious), and ran from 1941 through 1942, culminating in the construction of the world's first nuclear reactor (CP-1). In the USSR, this did not really occur until 1946, when the researchers for the first time had access to the resources (e.g. uranium) and funding they needed to do things like construct their first operational pilot reactor (the F-1). As an aside, Germany never really made it through this phase — the war ended before they could get a demonstration reactor operating. The output of the pilot phase is information, tacit knowledge (i.e., hands-on experience and familiarity), and some novel materials (e.g., the first tiny samples one might have of enriched uranium and plutonium).
The third phase, which is often much more distinct, is the production phase. This is the phase that we associate with a full-blown "bomb project." This is the hard part, where you have to take the insights gained from the previous two stages and scale them up to industrial sizes. This is where you build full-sized uranium enrichment facilities (which can be huge), and/or plutonium production facilities (industrial-sized nuclear reactors, fuel processing facilities, and so on). This is the phase that, in the 1940s, required the labor of hundreds of thousands of people, and required billions of dollars. You can think of this phase as being an even 1000X the size of the previous phases, at least in the 1940s, if you want a bomb as soon as possible (if you are willing to take it much slower, and use more modern technologies, there are ways to do this cheaper and slower, but the US and Soviet programs were essentially similar in size and expense). Most of the employment involved is in the form of construction labor and people who are necessary to operate the plants, as well as those who produce the materials necessary (e.g., uranium miners). For the US, this is what was call the Manhattan Project (1943-1945). For the USSR, this did not really begin until 1946 or so (when the work was taken over from the Foreign Ministry by the NKVD), though you can think of Stalin having authorized this in August 1945 when he put Beria in charge of the project. (German never got close to this phase of the work.)
With that in mind, you can see that while the Soviets did have a small research project during the war, it was not until August 1945, and the looming end of World War II and the beginning of a new phase of history and conflict, that Stalin authorized a production project, and even then it did not really begin in earnest for a year. Why the delay?
It came down to the resources, in the end. The Soviet Union was in no place to spend billions of dollars and the labor of hundreds of thousands of people on a postwar project in the middle of World War II. They were totally mobilized as it was for the prosecution of the war against Germany, and the recovery from the ravages of that war. It was only with the closing of World War II, and the confirmation that the future relationship with the USA would be antagonistic (which was Stalin's takeaway from both the Potsdam Conference and the bombing of Hiroshima) that Stalin felt it was time to make the full investment in a bomb of his own.
So the Soviets did have a small program during the war, but it was primarily concerned with analyzing the espionage information that was coming in about the US and UK programs, and also concerned with laying the groundwork for a larger program (for example, by seeking out domestic sources of uranium ore, which they did not have extensive knowledge of, and would need by the tens of thousands of tons). The early program was quite modest by the standards of the later one, but was successful enough that once Stalin gave it his blessing and priority, they basically were able to swing quickly into a pilot phase of work, and from there into the production phase. (And while the espionage helped a bit in this, it should not be overemphasized as having "sped" them up greatly. They still re-checked and re-did all of the work, because they did not fully trust the espionage information was accurate, and it takes much more than a few reports and diagrams to make a production-scale bomb program.)
On the Soviet bomb program, the best books are Holloway's Stalin and the Bomb, which has held up very well despite not being privileged to some of the newer records about how they used the espionage information, and Gordin's Red Cloud at Dawn, which was able to use much more recently released Soviet sources to get a fuller understanding of the work (and also takes an explicitly comparative approach with the Manhattan Project).