Are you sure its the engine?
How many hours on the piston?
How long since the valve clearances were checked?
Has it got all fresh fuel in? (could it be 'pinking'?)
My crf450x is reknowned for making clanking noises but its normally the chain 'slapping' the swinging arm
If it is just the cam chain tensioner it can be changed from 'outside' without doing any engine dismantling, if however it's the cam-chain that has stretched beyond adjustment then you have no option but to replace the cam-chain (IIRC it can be done without disturbing the head anyway)
My only experience is with a 250F (son's MX race bike) and we changed the camshaft for a 'later' year cam with the automatic-decompressor which made it a lot easier to start, i don't know if the 400 is similar or not though
Good luck with finding out the problem but be aware that if the cam chain is 'slack' and it jumps a tooth or two it can cause major damage