Rabi switch of condensate wave functions in a multicomponent Bose gas