Great question about the career opportunities that can be facilitated by a Computer Science degree, but why not pursue a degree in astronomy if that's your true passion?
A degree in either Computer Science or in Astronomy can offer a wide range of opportunities... check out this link at the American Astronomical Society for some specific career suggestions related to astronomy https://aas.org/learn/careers-astronomy. If you're interested in pure astronomy, you'll want to consider graduate school programs specifically in astronomy.
Applied computer science opportunities exist with almost all defense contractors involved with satellite construction. If you're attending a school lacking a formal astronomy major, I suggest you consider leveraging a CS background to pursue a position with one of these firms, or directly with NASA.
Another issue to consider is that some positions related to astronomy will require a government security clearance. Pursuing a position within the DoD, either as a civilian or as a member of the armed forces, can help position you to obtain an initial security clearance without having to convince a commercial employer to sponsor you for the investigation.
Whatever direction you pursue, work hard to be the absolute best at what you do and the opportunities will present themselves.