SPOILERS:
Don't tell the captain to get rid of the alchemist, don't choose to take revenge (when you find out what happened to a certain someone)
Otherwise you autopick the "let's kill the senior alchemist and the Duke", leading you to that ending.
So...
Sorry, you'll have to start all over again, I feel your pain, did that like 5 times T_T