stop earth from being destroyed
We start with 1.67x10^39 J, and we just need to ensure that the cross section of the explosion with Earth doesn't exceed 2.24x10^32 J.
First, we know that the distribution of the energy at a certain distance is even over the surface area of a sphere at the given radius. So the energy density of the explosion at a distance R is E/4PiR^2.
The cross-section of earth is the projection of the sphere on another sphere, which is just a circle. This cross-section is Pi*R^2 with a radius of 6371 km. Don't worry about some parts of the earth being closer, the energy intercepted at a closer point is the same as if it would have been encountered at further away.
The amount of energy from the explosion at a distance r is then the energy density at a distance r times the cross section of the earth.
So we are solving for 1.67x10^39/4PiR^2 * Pi6371000^2 = 2.24x10^32. Where these are equal we will be at the minimum safe distance. This simplifies to 1.694610^52/R^2 = 2.24x10^32 which further simplifies to sqrt(1.694610^52/2.24x10^32) = R. Which gets a minimum distance of 8697803 kilometers or 22.6 times as far from earth as the moon is. The earth will be barely not destroyed. the energy density is 1.756610^18 Joules per meter. with a head down human cross section being 0.18 meters square. A human facing the event would get 3.1610^17 joules of energy. the heating the would endure if the radiation is all heat is. 3.1610^17 = 62 kg * 3.6 kj/kg * heat change or 1.415*10^12. So they would be thoroughly dead. But earth would not be destroyed.
safe for humans value
All the energy is heat
For a human safe value we need to work backwards. Assuming all the energy is heat we need to find how much energy we need to cause heat stroke. The average temperature of the earth is 15 Celsius, the maximum survivable temp most humans can endure is 40 Celsius. Note that you still get heat stroke and organ failure, but it is survivable in theory. The atmosphere will absorb about half of the radiation, so we can double the energy we need. 62 kg * 3.6 kj/kg * 25 = 5580000 Joules. Maximum energy density is 25580000/0.18 or 62000000 joules per meter. solving 1.67x10^39/4PiR^2 = 62000000 simplifies to 1.67x10^39/4Pi62000000 = R^2 which is sqrt(2.1410^30) = R so the final distance is 1.4610^15 meters or 1.4610^12 kilometers or 0.154 light years. That is 324 times further from the sun than Neptune is. That isn't far enough to be in a different star, in fact it won't even be outside of the Oort cloud.
0.154 light years
All the energy is gamma or x-ray radiation
Gamma/X-ray radiation is much more dangerous than heat, but it is also absorbed more by the atmosphere. About 700 joules will kill an average person. luckily, air will stop the radiation. Air halves the amount of radiation received for every 90 meters, so values similar to 1*10^-30 are about how much you need to multiply incoming radiation to account for the atmosphere.
Saved by the atmosphere, at least until it starts raining radioactive air.
All energy is Radio
Radio can pass through the atmosphere. 100 mW/cm^2 is a clear hazard according to this study. that study doesn't give a clear lethal dose, but 1000 times that might be a lethal dose in a super nova burst (taking into account the smaller time period). So we need about 1000000 joules. sqrt(1.67x10^39/4Pi1000000) = R gets a distance of 1.1510^16 meters or 1.1510^13 km or 1.22 light years. that is still in the Oort cloud, but a bit further.
1.22 light years
I have had trouble finding sources on lethal doses of UV and Visible light.