Does the tapping noise increase in tempo and/or intensity as you raise the RPMs? Is there a point where the tapping noise is less noticeable - ie, when the engine is cold/hot, etc.? Does it tap excessively at idle speeds (no throttle input)?
Sounds like whenever the engine is heavily loaded, it makes that tapping noise and loses power. Couple of possibilities - one is detonation, knocking or pinging, which will cause that telltale metallic knock/tap/or pinging noise when you load the engine. Some cases, you could get enough knocking to cause the ECM to pull timing to protect the engine - when that happens, there will be a very noticeable loss of power. A quick way to check for that is to run premium fuel once to see if helps with the pinging - as the most likely cause of this hot spots inside the combustion chamber (carbon deposits the most likely) causing the detonation. The higher octane has a higher resistance to knocking and detonation.
Another possibility is the VVTi system, in particular the OCV (oil control valve) and its associated oil filter, are plugged up - causing the engine timing to be thrown off. If the filter is clogged with debris, sludge, etc. - it will reduce the available oil and oil pressure made to the oil control valve. Without that oil and pressure, the valve cannot move the VVTi actuator correctly, throwing the timing off. Normally, all this will be caught and flagged by the CEL (check engine lamp), but in more gradual failure cases, may not trigger the failure threshold. There is a write up on this forum to remove the OCV filter and inspect it for debris. If the filter is clean, then the oil control valve and the rest of the VVTi system. Sometimes switching to a different motor oil or shortening the oil change interval can help.