This can be seen as an extension of the War of Independence because independent countries need to have their rights respected by other countries. If other countries do not treat a country as if it is independent, what does its independence truly mean? This was the case with the Barbary Wars.
Before the Revolution, the British Royal Navy had protected American ships in the Mediterranean. After independence, the Barbary Pirates forced the US to pay tribute for the protection of US ships and still continued to attack US ships at times. Eventually, the US went to war to prevent the attacks and to force a renegotiation of the treaties that called for the tribute.
By forcing the Barbary States to stop attacking US shipping (they would not completely stop for about another 10 years), the US was forcing other countries to acknowledge that it was an independent power and had to be treated as such. Therefore, this war can be seen as an extension of the War for Independence.