A quick summary of the context in the Bhagavad Gita:
Ajurna, an aristocratic (Pandava Prince) warrior highly skilled in archery - right before engaging in a battle of two armies (two groups of cousins: Kauravas and Pandavas) for the succession of the throne - upon seeing all his close kin arranged in two opposing parties all with their unique skills and feats ready to kill and be killed - the warrior prince falls into a deep emotional turmoil. He begins to talk to his charioteer Krishnu who reveals himself to be an avatar of the deity Vishnu.
This dialogue evolves into a whole contemplation in which a part of the upanishadic cosmic view gets revealed to Arjuna/the reader; somewhat akin in style to the secular western form of Plato's dialogue (in this case the Socratic method is led by "reason" or "logos" not a sophisticated mythology like an avatar of a specific deity).
The dharma in the specific case of Ajurna, is to fulfill his caste duty of Kshatriya [1].
Or from the lens of quantum mechanics and modern history the bomb in some way or another was inevitable.
Its fine-tuned parameters (1) put in the Big Bang, the idea (2) conceived by Szilard [2] and the Anglo-American military apparatus (3) rather than merely convinced in its superiority putting the actual resources/technology into the ultimate pragmatic use [3][4] (first mover & cost/risk-reward ratio).
[0]https://www.holy-bhagavad-gita.org/chapter/11/verse/30
[1]https://en.m.wikipedia.org/wiki/Kshatriya
[2]https://www.newscientist.com/definition/invention-nuclear-bo...
[3]https://en.wikipedia.org/wiki/German_nuclear_weapons_program...
[4]https://en.wikipedia.org/wiki/Werner_Heisenberg#Membership_i...