The number of yards of dirt you need depends on how thick a layer of dirt you need. You may not want the same thickness over the entire area but you need an estimate to find the number of cubic yards of dirt required. I can't do the calculation for you since I don't know the thickness but I can show you what to do.
Since cubic yards is yards yards yards you will need all three dimensions in yards. There are three feet in a yard so
40 ft is 40/3 yards and
6 ft is 6/3 yards
I assume you will have the thickness T in inches and there are 36 inches in a yard so the thickness in yards is
Thus the amount of dirt you need is
40/3 6/3 T/36 cubic yards
where T is the thickness in inches.