Yes, the damage over time (DoT) from Infestation counts as indirect damage. Since Magic Guard prevents indirect damage, it will block the damage over time, but not the initial hit, as that counts as direct damage.
Source: I've tested this myself various times on Showdown's Balanced Hackmons ladder.