For the shin guards without the attached socks, why can’t you just wash it by hand? It’s made out of hard plastic and some type of foam cushion.
For the shin guards with attached socks, I soak it in warm water. I then squeeze the socks and dip it in water again and squeeze again. I do this repeatedly 3-4 times. I then let it dry using a fan and sometimes dry it in the sun to let the UV rays kill any bacteria. This seems to work. If someone has any better ideas, I would love to hear it.
Most importantly though, after practice or game, make sure you don’t leave it in the bag. If you’re too lazy to wash it right away, make sure to leave it in a place where it can be air dried so bacteria won’t grow.