This paper examines one of the most important operational problems in seaport terminals, namely the Berth Allocation Problem (BAP) which finds an optimal assignment of ships to the berths that minimize the total waiting time of all ships and reduce congestion in ports. Our problem is to affect and schedule n ships on m berths to minimize the processing time and the waiting time for all the ships in the port. Therefore, ships stay time in the port known by the flow time, while respecting the physical constraints existing at the port (such as the depth of the water berth and the draft of the ship’s water), knowing that each ship can only accommodate one ship at a time. It is as if it was a case of n tasks and m machines in parallel, and we wanted to schedule the passage of different tasks on different machines, knowing that each task can only pass on one machine and that the interruption of the task is not allowed. For example, if a job started on a machine, it will remain on this machine up to its completion. In our case, tasks are ships and machines are berths that are opting to minimize the total flow time and, therefore, to decrease the residence time of all the ships in the port. In a first step, a Mixed Integer Linear Program model is designed to address the BAP with the aim of minimizing the flow time of the ships in the port, our sample can be used for both static and dynamic berth allocation cases. In a second step, this model is illustrated with a real case study in the Tunisian port of Rades and solved by a commercial solver CPLEX. Calculation results are presented and compared with those obtained by port authorities in Radès.