i have come to accept that a strong military power can serve as a deterrent to others, and ultimately lead to a more peaceful existence (in the aggregate). i don’t believe that human beings can co-exist peacefully, so this deterrent is necessary (until we have some other means to achieve peace).
i would use a similar thought process to morally justify work on a general AI. given enough time i believe that humanity will destroy ourselves and this planet. in lieu of another solution, we may need an AI to assert control to prevent this from happening (or backfire and bring us fully into a hollywood dystopian future).
at the risk of going on a rant now, i have often found it hard to morally justify working on space travel, as i don’t believe that humanity has demonstrated that it deserves to colonize beyond Earth. that would only enable us to consume and destroy more of the universe.