When I put my 95 wrangler in 4 high I get a loud clicking sound when rolling. Don't know how long it has been since it was shifted in 4 wd. New to jeeps.
With the engine off grab hold of the front drive shaft and twist it back and forth and look at the u-joints. If there is any play replace them.
You havea yj. It also could be spring wrap. Normally when not in 4wd there is no real torque on the front springs. In 4wd the axels try to rotate and the springs hold them in place. That torque exerted on the springs causes the metal to rub and slap depending on how it is exerted. Look at the springs in the center and make sure none are cracked. This happened on my truck. Center spring cracked and fell out while driving down the road. Luckily I was demonstraiting the noise to the dealer mechanic.