Partially, yes. Certainly the public's negative opinion towards the military in the US after Vietnam played a part in Phase 2/TMP's decision to downplay the military nature of Starfleet in comparison to TOS. However, it was after Roddenberry was removed from power over the Trek movies following TMP that he began claiming Starfleet was never a military, and even then only as a means to discredit Nick Meyer and his militaristic interpretation of Starfleet.The "no military" thing reflects the attitudes of the public towards the military in the 1970s/1980s.
Then when TNG premiered, Roddenberry for some reason went out of his way to hate the military in general, as reflected when he banned Diane Carey from writing anymore Trek novels all because she dedicated a TNG novel she wrote to a friend of hers killed in military service, a ban which wasn't lifted until after Roddenberry himself died.