Would you *really* want to spend the time knitting a sweater smelling musty yarn the whole time??? I'd wash it first for sure!
It'll take some doing...you'll have to undo all the balls into hanks for the washing process, let them dry, and then rewind them into balls.
For washing, just use "luke" water, neither hot nor cold, a good gentle soap or wool wash, and gently squeeze water/suds through the yarn. You can let it soak a bit too to try to eliminate the smell. Rinse several times in same temp water, squeeze in towels several times to remove excess water and hang on plastic hanger to dry away from sun.