Read the Instructions
The bag must have a label that carries instructions on how to wash the bag in a washer. It will tell you the time, the kind of water temperature and the kind of washing liquid that should be used. These instructions must be followed as they have been devised after research on the given fabric and will ensure that the backpack does not get damaged in the washing process.
Put the bag in a laundry sack, especially if it has a lot of straps on it to save it from getting stuck. You can also use a pillow case that is large in size for this purpose. You can also give a try to turning it inside out to see if that works but the idea to use the sack is more likely to work.
Keep it at the gentlest of cycles where the speed is really slow. Add very mild detergent powder or liquid so that the colours do not bleed. Ideally wash it in cold water, otherwise in very lukewarm water.
Keep an Eye
While it washes, keep a close eye on the process as the backpack can get stuck. If something like this happens, stop the washer and adjust its position.
Once it has been washed, remove it from the laundry sack or the pillow case. If it is inside out, flip it back to its normal position.
Dry it by hanging either in the outdoors or with the shower curtain rod. The water will keep on dripping for quite a bit of time so make sure that it does not cause any problems. Having it hanging in the sun will increase the speed of the drying process.