Due to the rapid proliferation of transportation, the vehicles that are connected to a centralized cloud have led to an exponential increase in data generation and also provide high computational demands in vehicular networks. Traditional methods depend on centralized cloud processing, which introduces significant delays due to the time taken for data transmission. This latency is particularly critical for real-time vehicular applications that demand immediate responses for safety and navigation purposes. Therefore, fog computing has emerged as a promising solution to address latency and bandwidth constraints in cloud computing. By decentralizing computation and bringing resources closer to the end-users, fog computing significantly enhances data processing efficiency. Hence, this article devises an innovative framework, called Fractional House Swallow Optimizer (FHSO), for user clustering and resource allocation in fog-based vehicular networks. At first, a fog-based vehicular network is simulated between cloud data centers and a fog Virtual Machine (VM). This simulation replicates real-world vehicular mobility patterns and communication flows to evaluate performance metrics accurately. Then, user grouping is done by Fuzzy Local Information C-Means (FLICM) Clustering based on Signal-to-Interference-plus-Noise Ratio (SINR) and user distance. After user grouping, resource allocation is performed by the proposed FHSO. FHSO is the combination of the Fractional Concept and House Swallow Optimizer (HSO). For 1000 iterations, FHSO achieved energy efficiency of 80.878 Megabits per Joule (Mbits/Joule), throughput of 95.768 Megabits per Second (Mbps), and subchannel utility of 290.988 bits per second per Hertz (bps/Hz) with 150 vehicles.