Thumping when accelerating

Our 1998 Subaru Forrester has a scary thumping in the accelerator when the engine is under a load. The greater the load (e.g., going up a steep hill), the greater the thumping. It is not noticeable when idling or coasting. The local mechanic (Pep Boys) ran an engine diagnosis and declared nothing wrong. Any suggestions are appreciated!