You should have three steps :
xrds.rio.set_spatial_dims(x_dim='lon', y_dim='lat', inplace=True) xrds.rio.write_grid_mapping(inplace=True) xrds.rio.write_crs(crs, inplace=True)
This way, QGIS will understand the attached CRS.