To dream of a hat represents your mood or attitude that is only display to others. How you choose to feel or how you like to feel about yourself. The mood you are projecting to others.
The color and style of hat suggest what kind of mood you are in.
Dreaming of a red hat may reflect an attitude being displayed to others that has dangerous or arrogant intentions. Showing others that you know you are being dangerous or mean.
To dream of trying on different hats may reflect your attempt to prepare for a new role. Trying to find the right attitude to approach a new situation. Testing out different personality types to discover what suits you best.
Alternatively, hats in dreams can sometimes reflect issues with hiding hair loss from others and anxiety about other people discovering your hair loss problem.
Example: A woman dreamed of hiding her perfect hair under a hat and not wanting others to discover it. In waking life she had a genetic hair loss problem and wore a hat to cover it up. She didn't want people she had just met to discover or question her problem when talking to them a second time.
Fact: Headaches sufferers often dream of wearing hats that are too tight.