Infectious diseases thrive in war-torn societies. The recent sharp increase in human conflict and war thus requires the development of disease mitigation tools that account for the specifics of war, such as the scarcity of important public health resources. We developed a compartmental, differential equation-based disease model that considers key social, war and disease mechanisms, such as gender homophily and the replacement of soldiers. This model enables the identification of optimal allocation strategies that, given limited resources required for treating infected individuals, minimize disease burden, assessed by total mortality and final epidemic size. A comprehensive model analysis reveals that the level of resource scarcity fundamentally affects the optimal allocation. Desynchronization of the epidemic peaks among several population subgroups emerges as a desirable principle since it reduces disease spread between different subgroups. Further, the level of preferential mixing among people of the same gender, gender homophily, proves to strongly affect disease dynamics and optimal treatment allocation strategies, highlighting the importance of accurately accounting for heterogeneous mixing patterns. Altogether, the findings help answer a timely question: how can infectious diseases be best controlled in societies at war? The developed model can be easily extended to specific diseases, countries and interventions.