How to change the order of dimension of a xarray: transpose
In your example, that would be:
rainfall_dataset['rainfall_depth'].T.transpose('time','x','y')
i.e.:
Dataset['Variable'].T.transpose('dim1','dim2','dim3)
Required: List all dimensions in the desired order.
If you want a modification of your variable in your dataset:
rainfall_dataset['rainfall_depth'] = rainfall_dataset['rainfall_depth'].T.transpose('time','x','y')
i.e.:
Dataset['Variable'] = Dataset['Variable'].T.transpose('dim1','dim2','dim3)