You misunderstand how the system works, both Forge and Optifine (in its standalone form) install as if they were Minecraft versions.
To run Forge with Optifine simply install Forge and select it as your desired Minecraft version, then put a Forge-compatible version of Optifine in your mods folder.
Note: The existence of a Forge-compatible version of Optifine for your desired Minecraft version is not guaranteed.