It is highly advisable to refrain from an environment you can’t replicate in the actual test location. Experts suggest test takers recreate a similar atmosphere to help your brain retrieve information swiftly.
Thus, you can, but should ideally stay away from listening to music while studying for MCAT.