Yes, you can use rainwater in your aquarium, but you have to know a few things first before using the rainwater.
What is the hardness of your tap or well water?
What fish are you keeping or intending to keep?
What are the preferred conditions, especially water hardness, of the fish you are intending to keep?
In the USA, rainwater does not contain a lot of airborne pollutants. That may not be the case in other countries. Pure water is slightly acidic and contains no buffering chemicals. Rainwater has a hardness or TDS (total dissolved solids) of close to zero.
Some wild Betta species, many tetras and rasboras all like very soft, acid water. Some even live in waters with almost zero TDS and a pH of 5 or below. These fish can live in pure or nearly pure rain water. You may use pure rainwater mixed with 5 or 10% tap water for fish like these. You need to monitor the aquarium closely. Because there is no buffering capacity in the water, the pH can quickly drop to dangerously low levels of you overfeed, for example.
On the other hand fish from Lake Tanganyika come from very hard water with a pH of 9 and a TDS of 600 ppm. Even with hard tap water, many people need to add additional magnesium and carbonate salts and other buffering chemicals. You could use rainwater but would have to heavily treat and buffer the water.
Most aquarium fish live in conditions between these two extremes. If you know the TDS of your tap water, you can use rainwater to mix with it and get the TDS to where you want it for your fish, typically 200 to 400 ppm. You also need to measure General Hardness and Carbonate Hardness. These are associated with, but not necessarily directly correlated with TDS. With experience with your water you can use TDS as general proxy for hardness.
If you are not willing to do all this work to understand your water chemistry, assuming your tap water is already supporting aquarium fish, and you are not keeping hard water fish, start by using 25% rainwater with your water changes. If the fish do fine and the pH stays between 6.5 and 7.5, you can increase to using up to 50% rainwater. If the pH starts to fall, cut back on the amount of rainwater you are using.
Texture 193 by Malleni-Stock