#"Can I ask a company what I should wear to an interview?"
Of course you can ask what to wear during the interview. You just will likely get an ambiguous answer like "Wear whatever you feel comfortable in."
Rather than asking an open-ended "what should I wear?" you should guide the person you ask in to giving you actual information.
Will wearing a suit to the interview be okay?
This pushes the person to give you a firm "yes" or "no", and gives you more information based on how they respond.
At the end of the day, as long as you don't come in wearing shorts and sandals, your dress will likely consist of less than 1% of your evaluation and won't have much bearing on whether you get hired (people may say they won't hire someone because of their dress, but if they were the perfect candidate and slightly over/underdressed, they're going to get hired by any reasonable company you'd want to work for).