Measure the gaps on both sides of the dishwasher using a tape measure with the appliance in the recess between the cabinets.
Put on eye protection. Cut lumber to match both the height and the width with a circular saw and a planer. Use the circular saw to cut the lumber to the right height and the planer to thin the wood to the right width.
Fit both lumber pieces between the dishwasher and cabinets to ensure they fit.
Stain both lumber filler pieces with a color matching the cabinets using a paintbrush and let dry. Apply more coats of stain as necessary until the color is dark enough to match the cabinetry.
Pull the dishwasher out of the recess and fasten the lumber to the sides of the cabinets using glue or finishing nails and a hammer.
Slide the dishwasher back into place to finish.