Is it safe to cook with rainwater?
You really need to filter it first. If you wouldn't drink it, don't cook with it (also good advice re: wine). There seem to be sources on the internet regarding how to make rainwater drinkable, so I would start there.
(example: http://www.rain-barrel.net/drinking-rainwater.html)

If you're already drinking your rainwater, and haven't died yet, it's probably safe to cook with.

If you're planning on using it as an ingredient in baking, or any dish where the pH is critical, you may want to actually test the pH of the water you're putting in and try to balance the recipe accordingly (substitute some baking soda for baking powder, for example).