This question already has an answer here:
In the Hobbit, when Bilbo finds his magical ring, Gandalf only warns him that some magical rings are not safe but he has no idea that Bilbo's magical ring is actually the One.
Does Gandalf, at this time, know that the One Ring does still exist?
The accepted answer to this question states that
Gandalf didn't know the ring was still around.
However, I highly doubt that. Elrond knew that the Ring was not destroyed at Mt. Doom and that the only way to get rid of Sauron was to destroy his ring. Furthermore, it was the task of the Istari to fight Sauron - since they were still in Middle-Earth, they must have known that Sauron is still around (otherwise why would they stay in Middle-Earth?) which implies that the One Ring is still around too - just it's whereabouts are currently not known.
Thus, Gandalf must have known all the time that the One Ring is still around somewhere. It just took him a while to figure out that Bilbo found it by pure chance.