Artificial intelligence has become a hot research topic in the field of technology worldwide today. This article will discuss a hash and genetic algorithm based model suitable for prefabricated buildings. This article first introduces the application of artificial intelligence algorithms in solving nonlinear programming problems. Then this article proposes to improve the time loss caused by vector distortion caused by similar neighborhood selection in traditional methods, and preprocess the results to improve decision-making accuracy and other characteristics. Finally, this article verifies through experiments that the model is more effective and operable than traditional algorithms under the optimization of artificial intelligence algorithms. The verification results are as follows: In terms of running speed, the performance of artificial intelligence algorithms is 43 m/s, while the performance of traditional algorithms is 24 m/s; In terms of operational efficiency, the performance result of artificial intelligence algorithms is 95%, while the performance effect of traditional algorithms is 74%; In terms of visualization level, artificial intelligence algorithms have higher performance results, while traditional algorithms have lower performance effects. In terms of reliability, the performance result of artificial intelligence algorithms is 0.53, while the performance score of traditional algorithms is 0.43; In terms of robustness, the performance of artificial intelligence algorithms is 0.74, while the performance result of traditional algorithms is 0.67. The accuracy of artificial intelligence algorithms is 84%, while the accuracy of traditional algorithms is 65%. These test results indicate that using artificial intelligence algorithms can assist designers and engineers in optimizing design, automatically generating models, and conducting structural analysis and durability verification. This method helps to reduce errors and waste in the construction process, improve building quality and construction speed.