I am sure it will kill fleas--it can kill anything if you use enough. But is it SAFE to use on your carpet? Probably not--it will probably ruin it.
And you WILL burn your poor dog's skin if you use it on the animal--it probably would be and should be considered abusive, legally.
Borax actually gets warm or even hot when it gets wet...Lumps of old Borax in your skimmer can get very hot when they get wet.
Go to your vet and get proper flea-killers and use them as directed. There a substance you put on the dog's neck between the shoulders that kills fleas and ticks for 30 days or more.