The "ideal weight" is tough, because "ideal" means something different to everyone. For instance, you might be in a healthy BMI category for your height and may be extremely healthy by all doctors' standards, but you might still feel discontent with your weight. It's also hard to know if you're within a healthy weight range because you didn't give your height. How tall you are is a huge deciding factor on a healthy weight range. BMI uses height and weight to estimate if you're in a healthy "Body Mass Index" range but fails to take into account body composition. Muscle weighs more than fat so your weight might be higher because you have a lot of muscle, but on the BMI scale, it might look like you weigh "too much." Therefore, BMI isn't a great indicator of a good weight. It's better to gauge your health based on a doctor's lab results, how you feel about yourself and your body, and how well you can perform daily tasks and live your best life. If you eat moderately healthy, have healthy lab results, exercise in a way that feels right for you, and are able to do all the things you want to do in life, then you can arguably be at your own ideal weight! (But if you really want a number to shoot for, look up your height/weight on a BMI scale and then aim for a healthy BMI range for your body, between 19 and 25.)
It's also important to say that, no matter WHAT your weight is, if you put in the training and prepare yourself to run a 5k, then you should run the 5k! Find a training plan that gets you into running shape in the weeks leading up to the race, and stick to it. If you're not in shape, it might be hard at first but if you stay persistent with your running, you might surprise yourself on race day! Weight isn't as important of a determinant for whether or not you can run a 5k as much as the work and training you put in beforehand.
Sources
https://www.cancer.org/cancer/cancer-causes/diet-physical-activity/body-weight-and-cancer-risk/adult-bmi.html