Technically, you can - but we wouldn’t recommend it! The powerful brushes can scratch the paint on the rack, or even mangle it altogether. Since removing a rack can be done in a matter of minutes, it’s always worth taking it off before venturing into a car wash.
With this in mind, cleaning your roof rack regularly is still important to keep it in good working order. Try using a metal polish rather than conventional car cleaner, as this should provide a protective layer against dust and mean you won’t need to clean the rack as frequently.