Step 1: Understand the potential energy of a pendulum.
The potential energy \( U \) of the pendulum at its extreme position is given by:
\[
U = M g h
\]
where \( h \) is the height the pendulum rises to from its equilibrium position.
Step 2: Use the geometry of the pendulum.
For small angles of oscillation, the height \( h \) at the extreme position can be approximated by:
\[
h = L - L \cos(\theta)
\]
where \( \theta \) is the angular displacement of the pendulum. Using the small angle approximation \( \theta \approx \frac{A}{L} \), we get:
\[
h \approx \frac{A^2}{2L}
\]
Step 3: Calculate the potential energy.
Thus, the potential energy at the extreme position is:
\[
U = M g \frac{A^2}{2L}
\]
Step 4: Conclusion.
Thus, the potential energy at the extreme position is \( \frac{MgA^2}{2L} \), which corresponds to option (D).