You got three justifications for military melee weapons modern ir scifi:

1. Useful tool that's at most a rare tertiary weapon.
2. Less lethal alternative to guns.
3. Not everyone has guns.

Anything else needs a lot of justification.