I add it to my soil. It's not going to harm anything as long as you don't put too much; if you put too much it will become "muddy".
The food industry uses Diatomaceous earth as an "anti-caking agent" and that is why I use it as well; keep my soil loose. I suspect that as it breaks down it might also add calcium to the soil, but I have nothing to base this assumption on.
So, yeah. Use it. Like top fuel says, you can use it as an repellant for certain insects, but I'm not sure that it would benefit you as the bugs that usually attack cannabis probably won't be harmed by it. It works as a flea repellant because it gets in between the sections of a fleas body and cuts them up. I wouldn't bother with it for insects. You can, however, get wettable sulphur and use it during veg and a good ways into flower. I'd recommend giving the plants a good spray before harvest though, just to make sure all the sulphur is off.