Although it's not well-documented, fmpz_set_str supports base 0 to auto-detect based on prefix (it falls through to GMP):
fmpz_t y;
fmpz_init(y);
fmpz_set_str(y, "0x64", 0);
fmpz_print(y);
printf("\n");
fmpz_clear(y);
return 0;
https://github.com/flintlib/python-flint/blob/main/src/flint/types/fmpz.pyx#L84