If the bandits are killing unarmed folks, yes.
Otherwise there are more questions that have to asked case by case, but generally in D&D modules, the bandits are burning towns and murdering people, not ransoming wealthy merchants they stop and apprehend along the road.
I'm sure I've run into morally ambiguous situations in adventures before, but whether or not it's how the adventure was written or how the DM was presenting it is unsure. And even if I can point to a classic adventure and say "here, this one!" it's not proving some grand point, lol.
I've encountered a lot of people in the wild who tell me that D&D was meant to be this grand game of killing and looting, and that alignment and moral debates get in the way of that. And that even with more, uh, (insert term that doesn't demean the first group) players, sometimes a very simple premise for adventure can be bogged down into moral debate unless said adventure very quickly introduces clear cut 'black hats'.
It's because I have seen such behavior in play that I have my particular viewpoint that the game becomes very murky when it talks about good and evil, and WotC generally isn't any help in this regard. As an example, let's look at poison.
Traditionally, poison use in D&D is seen as a despicable act. Good characters never use poison, and the game seems loath to offer it to players without DM consent, usually shoving it's rules in DM-facing content. The Book of Exalted Deeds went so far as to claim that the use of poison (or spreading disease) is absolutely an evil act (but then, strangely, created toxins and diseases that were ok because they only hurt evil people).
But it's perfectly ok for normal creatures to use poison and that doesn't make them evil. Or for animals to spread diseases, it's perfectly neutral. Indeed, even intelligent creatures that have poisonous attacks can be non-evil! The pseudodragon is one such example (the argument can be made that since the poison is nonlethal that it's an exception, but in this case, the game never made an exception- after all, who else uses sleep poison? That's right, those d̶i̶r̶t̶y̶,̶ ̶d̶i̶r̶t̶y nice, friendly Drow!).
Druids have traditionally had spells like poison and contagion- are these the hallmarks of evil druids? What about Druids who summon venomous creatures or wild shape into them?
In 5e, is someone using the Poison Spray cantrip committing an evil act? Probably not, but why? Because it only does poison damage rather than infect you with some other vile effect? Why don't we hold spells that paralyze or affect someone's body or will in other ways to this standard?
D&D doesn't usually ask these kinds of questions, by default, because it's very very murky, and anytime the rules point at an action and say "this is evil!" you get a lot of players asking why. See any debate about why animating the dead is considered vile- people will offer up lots of examples why it couldn't be, or shouldn't be, but it is, regardless. So in the end, it's left for the players and the DM to hash out, and opinions can be highly subjective as a result.
And D&D doesn't even attempt to have morality rules or subsystems, even shoddy ones, like V:tM's Humanity. It says "uh, here are alignments. We're not going to tell you when they apply, or if they should, or what happens if people violate them. You can figure that out. Have fun!"
The game doesn't even give us proper guidance about what happens if a Cleric violates their Deity's edicts, or a Druid puts on metal armor. At best we get "oh they don't do that". The only exception is the Paladin, and that just points us at an optional subclass that isn't intended for general use (as it's in the DMG!).
I like playing Good characters, because I like to think of D&D characters as being heroic, but the game doesn't present any real reason why that's better or worse than being selfishly motivated neutral mercenaries, who are only going on this adventure because "otherwise there is no game".