I don't know exactly what tool you are using to build the package. Advanced Installer (Professional edition) can do this very easily, when creating an installer for IIS applications.
In the IIS page you can define the App Pools, web sites, web applications and virtual directories you want your installer to create, as shown in the above linked tutorial. For each web site and virtual application you can then select from itw own "Application Pool" view the corresponding application pool. Virtual directories do not support having different application pools from their parents.