Hi Jonny
The solution that Ruth provided is a good first attempt, but it has one obvious pitfall which you have already discovered: it requires knowing the order of dimensions before you can apply the operation. One of the major advantages of iris is that you almost never need to do this, it is usually possible to write a program in such a way that it will work without relying on dimension order. I have a few suggestions that may help get you on your way.
Firstly, the good news is that you don't need to rename the coordinates at all, iris is perfectly happy having two coordinates with the same name like this (although you may not be, we'll get to that later) and can tell the difference. I think all functions that accept a coordinate name as input will accept an actual coordinate object as input also (certainly true in the case of collapsed), which means you just need to be able to find your coordinate by something other than just name in order to collapse it. If you want to get the coordinate named "time" that is also a dimension coordinate you can do this:
time_dimcoord = cube.coord("time", dim_coords=True)
you can now pass this to the collapsed method to average over the time dimension:
mean = cube.collapsed(time_dimcoord, iris.analysis.MEAN)
If on the other hand you wanted to extract the auxiliary coordinate named "time", you could use
time_auxcoord = cube.coord("time", dim_coords=False)
This might be useful if did want to rename the time auxiliary coordinate to something else:
time_auxcoord.rename('something_else')
print(cube)
Hope that helps