How soon can we stain a freshly-sanded deck after it got drenched in the rain?
Prep is always the most important step. Make sure the wood is dry. It shouldn't make too much of a difference that it rained after you sanded it down as long as it still has pores to absorb the stain.

I always recommend placing a large tarp over the area so that if it does rain, you don't have to worry too much about your work.