Area is maximized and perimeter is minimized by using a figure that is as close to equilateral as possible.  Using the barn as one side of the pen, that means the farmer has 3 sides to fence.  300/3 = 100 feet for each side (this will make the figure equilateral).  This makes a square pen with dimensions 100 x 100.  This makes the area 10000 ft².