First of all, ich is not bacteria. Ich is a parasite that is found in just about everyone's aquarium. The reason it doesn't infest most fish is because healthy fish have the strength to fight it off. Do not blame the ich infestation on feeding your fish frozen food--instead review your betta's environment for sources of stress. Water quality is the major cause of ich, but it can also be triggered by low temperature or temperature fluctuations, and general stress caused by being in a high traffic area or being around other bettas.
Frozen foods are certified sterilized--very few things can live in ice. This is why we freeze our own food to preserve it. The problems can occur when we improperly treat frozen food. You should never thaw something and leave it out, and you should never thaw something, and then freeze it again, then thaw it again and feed it to your fish. Just like if you did that with human food--you're gonna run into problems that way.
Another thing I'd like to point out is that Hikari Bio-Gold used to be much better than it is now. They changed their formula a few months ago--they used to have meat as the first ingredient in the form of fish meal, but later changed the first ingredient to wheat somethingorother. Bettas are carnivores, so for them wheat has no value at all. Hikari pellets are now more like fish-flavored biscuits than real fish food. I recommend Omega One betta buffet pellets, Atison's betta pellets, Ken's betta crumble, and New Life Spectrum. All of these products offer whole meats as the first ingredient.
Also, you should always soak the pellet in a little tank water before feeding them to your fish. Fish were not intended to eat bready air-filled foods. Soaking them helps release their "scent" into the water, stimulating your fish to eat them, and it makes them easier to digest.