If you want to wash a baseball cap in the dishwasher, put the hat on the top rack with or without a protective hat frame. Use your usual dishwasher detergent. If the plastic in the brim begins to distort due to the heat, don't use the hottest setting.
Let's Get It Fixed!
HomeX virtual experts will assess your issue (for free!) and can resolve simple problems.