The mechanism of ultrasound absorption, is damped resonance. Every sound-carrying mode has some response that is slightly lossy, and generally loses a fraction of the energy per cycle of the signal. That means higher cycles-per-second results in higher energy loss rates.
The mechanism of X-ray absorption, though, is (mainly)
photoelectric effect. The rates of absorption are in proportion to
quantum-mechanical constants called 'matrix elements'
which are calculated as integrals of the product of the
oscillatory electric field of the X-ray, with the
electron orbitals of those involved electrons. High
X-ray frequencies correspond with short wavelengths, and electron orbitals scale with the Bohr length.
The integral of that product will vanish when the oscillation wavelength is short compared to the orbital, because
the oscillation is switching from positive to negative
while the electron orbital remains nearly constant. The
product, therefore, averages to zero.
Thus,
a sufficiently high energy/short wavelength X-ray becomes
very non-interacting (and penetrates without much attenuation).
As a practical matter, the energies of X-rays above photoelectric-effect absorption are called 'gamma rays',
and mainly only interact with the (very small) nuclei
of atoms. Size matters.