Okay, I will approach you with the thinking that you have some basic tools and are going to mount the flag on the top of the bed rail.
You will need to check out a marine supply store and locate a bulk head mount that has a verticle collar which you may insert the flag into (after cutting off the mounting tab). These mounts generally are used as bases for lights, but this really does not matter as long as the collar (tube) is long enough. Say, three inches. Something like this:
formatting link
Mount this on the side of the bed using something like this:
formatting link
Hollow wall anchors may be used, but generally are more problematic and require larger holes to get proper mounting strength in sheet metal. There are lighter duty snap-in type mounts that you might be able to find at an automotive store. These aren't the standard in-stock thing anymore.
Make sure that you smear some silicone on/around the above before attaching mount. Wipe off any excess when screws are snug.
If the mount has existing holes, that are machined/threaded, use those and a thumbscrew to lock the flag in place.
If not, put the flag in the mount and drill a hole through both and use a bolt/nut combo, or if you know how to thread and the material may be threaded, drill a hole in the base and use a thumbscrew.
This is just basic stuff that will help not make it look like a total hack job. Making a reusable sleeve for the plastic flag pole might be doable if you are good with the cut-off wheel of a Dremel.