Ants can easily find their way into your child's sandbox, because it's outside and some ants like to build homes in the sand. Precautionary measures can be taken by putting the sandbox away from any visible ant homes and keeping a tarp on the sandbox when it's not in use. However, the ants can still find a way into the sandbox and become pests to your children, especially if they are fire ants (red ants).
Keep a tarp over the sandbox when it's not being used and monitor the area around the sandbox for any ant homes. If you already have ants in the sandbox, these precautionary measures can make the sandbox less appealing to the ants, especially if you can move the sandbox away from any ant homes.
Fill a spray bottle with white vinegar and spray it evenly throughout the sandbox. This helps repel the ants and also keeps the sand clean for the next time your child plays in it. Plus, white vinegar is safe for your children compared to other chemicals that could be used.
If the ant infestation is extreme, it's probably best to start over by dumping out the sand and refilling it with new clean sand. After you have refilled the sandbox, use a lid or tarp of some kind to keep the box covered and spray white vinegar in the sand to prevent the ants from returning.
Monitor the sandbox every day and check to see if any ants have returned. Make a habit of spraying white vinegar on the sand after every use.