How much foreign language should a high schooler focusing on Computer Science take?

You should google the common data set of college you might be interested in applying to and see what level of foreign language is recommended/required. When a college says 3 years they mean to level 3 so you would be fine for those. However, if you are interested in a group of colleges that want 4 years then you would be putting yourself at a disadvantage by not taking Spanish 4.

Note that you may want to consider taking Spanish 4 over the summer, at a CC, with an accredited online program to meet the requirements and still have room to take the class you want. This is an option you might discuss with your guidance counselor next year.