I'll be the radical and say there is no way. Treat them well as you would any fish, with appropriate water and regular changes, and then hope your luck is good. I keep hearing store people talk of virus problems in cheap guppies, and there's nothing you can do if that's the case. You also have to deal with the after effects of growth speeding antibiotic use. The farms get them to market, and what happens after that is your problem.
Quarantine. It isn't an option with farm guppies. If you don't do it, you pay. I've had several fish store people tell me they want guppies to sell fast, so they can disinfect the tank and get the next lot in. Their magic number is three weeks. They expect any guppy not sold in that time to succumb to what it is probably carrying. I've had fish catchers I know say that if they could, they wouldn't sell the guppies they get, but those are now all they can get.
It doesn't mean they are all sick. But the odds are kind of high. I can recall when guppies and neons were really tough fish, ideal for beginners. Properly raised, even the inbred fancies are tougher than the cheap ones.
It's worth finding a local aquarium club, or doing what I did here when there wasn't one - starting a club. If you want good guppies, find a breeder and pay more for quality stock. By the time you count up the costs of all the dead ones, and the tank cleanouts, etc, you will probably be ahead.