Step 1: Check function of the word.
“Beautiful” describes the noun “dress” by telling its quality. Words that describe nouns/pronouns are adjectives.
Step 2: Eliminate others.
It is not an action (Verb), not a relation word like “in/on” (Preposition), and not a connector like “and/but” (Conjunction).
Step 3: Conclusion.
Therefore, “beautiful” is an Adjective — option (D).