We faced the same issue. Could solve it with following versions of kotlin, ksp and realm:
[versions] kotlin = "2.0.21" ksp = "2.0.21-1.0.28" realm = "3.0.0"