No, you cannot license software as free or open source software while discriminating against a particular organization or field of use. You can write your own such license, but it will fail to meet criteria like the Open Source Definition, the Free Software Definition, and the Debian Free Software Guidelines.
Also, the DoD in particular has sovereign immunity, so if they infringe your copyright, you somehow find out about it, and you sue them for it in the US, they can just refuse the lawsuit. The best you could do in that case is something like a WTO lawsuit, which, well, I don't think you can get by with less than a million dollars in legal fees. You could sue somebody like Boeing or Lockheed Martin but you're still going to have one hell of an uphill battle there. However, those organizations would probably prefer not to spend tens of thousands of dollars to fight your lawsuit, so they may comply with the license even if they would probably win in court.