While AP exams are unlikely to move the needle much in college admissions, if you end up at a school with distribution requirements, AP scores can allow you to skip those. This can be more valuable for subjects of little interest (by allowing you to check the box for that requirement) than for an area of interest, where it could make sense to do the foundation course to ensure full mastery of the basics as the college sees them.
I wouldn’t invest a lot of time studying for the exam if the course doesn’t cover the material. But if it’s a matter of review, it could be worthwhile.