I assume that this is a bread loaf with one side cut open and in addition, you dusted off all ants that you could see from outside. Ants cannot go too far into a bread loaf through the open end. You can cut another piece off from the open end and use the remaining loaf. (If you do not mind using the piece where ants were, then you could remove the ants easily from the cut piece now. I would not mind eating it as this is what typically happens in tropical regions.)
As a solution to not letting ants get on the bread in the first place,
(1) you could place it in a plastic bag and form a knot so that ants cannot get through. or
(2) Place the bread on top of a cylindrical object (for example, a used powdered milk container) and place the object (and the bread) in a (big enough) bowl (a wok) with water. Make sure that no parts of the cylindrical object are touching the lateral surface of the bowl.