Stinky dishes and cups from the dishwasher - but only after it rained
This sounds like a drain hose problem. If you can post a picture of the drain hose from where it leaves the dishwasher until it goes into the drain pipes (usually either into the pipes under the sink or into a disposal under the sink), that would be very helpful.

Key likely items:

1 - If the drain hose goes into the drain pipes past the trap then that would likely violate code and would definitely explain the problem. The trap is there to prevent sewer gases from getting back into the house - or into the dishwasher. If that's the case, you need to either move the drain hose so it connects before the trap or add another trap (and then connect it before the trap).

2 - Dishwashers require an air gap. There are two forms.

The first ("traditional" in my mind) is a gadget on top of a corner of the sink. The drain hose goes up to this gadget and the water has to literally go through the air (an inch or so) to then flow back down into another drain hose into the pipes. I highly doubt you have this because any sewer gas would be coming out of the air gap either all the time or every time you run the dishwasher.

The second method is a high hose loop. The flexible hose from the dishwasher loops up so that the middle of the hose is right up underneath the counter before looping back down to go into the pipes or disposal. The key is that water can't back up from the pipes through the drain hose into the dishwasher unless water was backed up in the sink just as high - which would be quite unusual (and quite obvious at the time). There is effectively an air gap inside the hose.

If you have a hose loop that no longer loops - i.e., the hose either was never installed properly or has fallen down - so that the highest point on the hose is not much above where it connects to the pipes/disposal then you will have problems. If you have this problem, moving the hose may be all that you need to do - just use a loop of wire or something to hold the hose up in the right place. If your hose is not long enough - or if you are concerned that it is filled with dirt, etc. - you can replace it for ~ $10 (US).



Update based on picture. There appears to be a normal trap (good). But the drain hose does not have a traditional air gap and only goes a couple of inches above the pipes. The highest point is significantly below the bottom of the sink, so it will definitely not function correctly the way it is currently installed.

It is hard to tell whether a longer hose with a proper high loop will be enough to solve the problem, but you should install a longer hose with a proper high loop anyway in order to have a proper installation. If the problem still happens after that then some more troubleshooting will be needed.