Yes, you can put guppies in a 5-gallon tank. As a general rule, a one-inch guppy should have one gallon for itself. An adult male guppy is around 1.5 inches long and an adult female is typically 2 inches long. Therefore, you should keep no more than three guppies in a 5-gallon tank.
Make sure not to overcrowd the fish tank as it can stress the guppies out.
Additionally, if you only have a 5-gallon tank available, you should keep only male or only female guppies. This way, you won’t accidentally end up with fry (guppy babies) that can overcrowd the tank.