It's not really that the alcohol is a factor, rather it's that the wort is boiled and the process of boiling kills the pathogens. As long as the beer isn't contaminated after boiling it's fine to drink.
The difference between beer and boiled water is that beer will generally stay uncontaminated due to the alcohol content, while boiled water is clean only for a limited time.