Contrary to the suggestion of the question, a space ship would not stop when it runs out of fuel. Even though there are objects in space like gas, dust and particles, they are in such low concentrations and so spread out that it is highly unlikely that a space ship would come into contact with anything.
This means that the space ship in question would not be slowed down by anything in space, or that it is highly unlikely that it would. This is because there would be no friction that would enable anything in space to slow down a space ship.
A space ship does not need constant thrust in order for it to move through space, unlike a ship on the ocean. Even when the thrust that comes from the fuel runs out, the space ship will still move forward thanks to the momentum that came from the fuel.
This momentum will then carry the space ship forward on the same trajectory that it was already travelling, even when the fuel runs out and the engine shuts off.
This momentum will continue to carry the space ship at a constant speed. And since it would cost an extortionate amount of money to send fuel into space for a space ship, space ships will tend to be designed to use as little fuel as possible. Not only would it be incredibly expensive to get fuel to a space ship, it would also be heavy and impractical.
Since space ships need to conserve fuel, the engines are normally turned off for most of the journey. This is because the space ship will still be moving even without the use of fuel as has already been explained. The engines will then only be turned on to decelerate.
So, when you watch Star Wars or any other movie that is set in space, you may realise that if a space ship constantly has its engines on, this is an unnecessary use of fuel.
In answer to the question, a space ship would not simply stop if it ran out of fuel; its momentum would keep it moving through space.
And since it is impractical to send up fuel to replenish the fuel supplies of a space ship, this hypothetical space craft would likely keep moving until it collided with something, which is quite unlikely to happen in space.