Most people report they have never had a problem with "dirty diesel." So, most likely neither will you.
However, there are exceptions to this rule. Some folks have reported "dirty diesel" problems ranging from poor performance and filter clogging causing a little inconvenience all the way to significant engine damage causing great delay and expense and even warranty denial if the rig is new.
The only way I know of to prevent getting a bad batch of diesel is to actually look at it before pumping it. I began doing this a few years ago. It takes an extra minute or two at the filling station, but for me it's worth it before pumping a few hundred bucks of potential problems into my tank.
To execute this low-tech approach, I have a gallon-size glass jar in my rig. After pulling up at the pump, I open the door where this jar is stored and pump a quart or so of diesel into it. If the diesel meets my approval, I proceed to fill my tank. About half way through the fill, I stop to pump another quart or so into the jar to make sure the fuel is still up to par.
I judge the diesel quality based on this simple criteria: The diesel must be clear, clean and bright, with usually a light golden or yellow tint. In cold weather, the diesel may be a bit hazy from the wax crystalization but this is acceptable and may prompt me to add some PowerService anti-gel compound to keep related problems away.
If the fuel is excessively old or dirty or has a lot of emulsified water mixed in it, it will be dark and hazy. If the fuel is contaminated with free water, there will be an obvious water bubble settling quickly on the bottom of the jar. All this fails my test.
When I encounte diesel that doesn't pass this test, I pay for the partial gallon and move on to more promising land and discard it later in an old oil bottle or two I keep with me for this purpose. It is not common to find problems, but it can happen. I've seen it myself.
I keep the the sample of my good downloaded fuel until I stop for the night just in case something might settle in the sample that I somehow missed at the station. Although this has never happened, I figure it doesn't hurt to keep it until I get a chance to pour it into my tank. A minor side benefit is that if I did miss something that only becomes obvious later, I have that sample to discuss with the station where I got the fuel for any appropriate redress of problems should they occur.
This process takes very little time but, for me, provides a lot of comfort way out there somewhere on the road.